sqlite-parser
sqlite-parser copied to clipboard
BUG: Named constraints lose names if other constraints are present
In this example there are two named constaints:
CREATE TABLE Bees (
wings integer PRIMARY KEY CONSTRAINT has_enough_wings CHECK (wings >= 2),
legs integer CONSTRAINT too_many_legs CHECK (legs <= 6)
);
The resulting AST has a name for the too_many_legs constraint, but the has_enough_wings constraint loses its name.
It seems that the parser drops the names from the constraints if any other constraint, such as NOT NULL, DEFAULT, PRIMARY KEY, is present on the column.