Support for composite primary key
kanekoshoyu opened this issue · comments
Sho Kaneko commented
Hi, I was wondering if there is any plan for a composite primary key in GlueSQL (esp shared memory)
Currently below is valid
let sql = " CREATE TABLE market (
symbol TEXT NOT NULL PRIMARY KEY,
side UINT8 NOT NULL,
level UINT8 NOT NULL,
price DECIMAL NOT NULL,
volume DECIMAL NOT NULL,
exchange UINT8 NOT NULL,
)"
when we insert another row with the same symbol, it will return error.
duplicate entry 'Str("ZEN")' for primary_key field
This is great, but I was wondering if there is any plan for support in things like below
let sql = " CREATE TABLE market (
symbol TEXT NOT NULL,
side UINT8 NOT NULL,
level UINT8 NOT NULL,
price DECIMAL NOT NULL,
volume DECIMAL NOT NULL,
exchange UINT8 NOT NULL,
PRIMARY KEY (symbol, level, exchange)
)"
where only the unique combination of (symbol, level, exchange)
is allowed. I tried the above but it did not do anything, so I believe it is not implemented yet.
https://www.geeksforgeeks.org/composite-key-in-sql/