On 7/28/16, Gerry Kleinpenning <[email protected]> wrote: > The following SQL create table statement is accepted:
This is an "undocumented feature". Really it is a bug in prior versions of the SQLite parser. But we have to maintain this bug moving forward to avoid breaking database files that might actually be using this disallowed syntax. SQLite stores the original text of CREATE TABLE statements in the sqlite_master table and reparses that text when the database is opened, in order to reconstruct the schema. If the parser for CREATE TABLE statements becomes more restrictive, then legacy database file that contain the older syntax will no longer be readable. That would be bad. Hence this "feature" must remain. Note, however, that you should avoid using this feature! It will remain undocumented. > > > CREATE TABLE CST_PAGE_z ( > > PAGE_ID INTEGER PRIMARY KEY, > PAGE_MASTER INTEGER NOT NULL, > PAGE_DETAIL INTEGER NOT NULL, > PAGE_HIDDEN BOOLEAN NOT NULL DEFAULT 0, > > FOREIGN KEY(PAGE_MASTER) REFERENCES CST_TABLE(TABLE_ID) ON DELETE CASCADE > ON UPDATE RESTRICT > FOREIGN KEY(PAGE_DETAIL) REFERENCES CST_TABLE(TABLE_ID) ON DELETE CASCADE > ON UPDATE RESTRICT > > UNIQUE(PAGE_MASTER, PAGE_DETAIL) > > ); > > > Notice the absent of the comma's separating the table constraints. > > According to the documentation > (https://www.sqlite.org/lang_createtable.html) these comma's are not > optional. > An external SQL parser based on the SQLite official documentation complaints > about this. > _______________________________________________ > sqlite-users mailing list > [email protected] > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp [email protected] _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

