sqltoast
sqltoast copied to clipboard
Handle explicit `<column> <data type> NULL` constraint specifier
The NULL constraint specifier is default for the CREATE TABLE statement, however we don't support it. We only support the standard NOT NULL constraint specifier:
jaypipes@uberbox:~/src/github.com/jaypipes/sqltoast/_build$ ./sqltoaster "create table t1 (c1 int not null primary key)"
OK
statements[0]:
<statement: CREATE TABLE
table identifier: t1
column definitions:
c1 INT NOT NULL
constraints:
PRIMARY KEY(c1)>
(took 28831 nanoseconds)
jaypipes@uberbox:~/src/github.com/jaypipes/sqltoast/_build$ ./sqltoaster "create table t1 (id int not null primary key, name varchar(200) null)"
Syntax error.
Expected to find one of (','|')') but found keyword[NULL]
create table t1 (id int not null primary key, name varchar(200) null)
^^^^^^
(took 61148 nanoseconds)
Should be a simple fix to ignore the NULL constraint specifier when NOT isn't present.