Re: [sqlite] Unexpected parsing of an invalid CREATE TABLE statement
Forgiving, yes, but usually not /that/ forgiving. It's certainly caused some wasted time going down the wrong path trying to debug an issue. On Mon, Jun 10, 2019 at 3:39 PM Richard Hipp wrote: > On 6/10/19, Shawn Wagner wrote: > > Consider: > > > > CREATE TABLE a(id INTEGER PRIMARY KEY); > > CREATE TABLE b(id INTEGER PRIMARY KEY); > > CREATE TABLE c(id INTEGER PRIMARY KEY, a_id, b_id, > >FOREIGN KEY (a_id) REFERENCES a(id) > >FOREIGN KEY (b_id) REFERENCES b(id)); > > > > Note the lack of comma between the two foreign key constraints in the > > definition for table c. The syntax diagrams in the documentation indicate > > that the comma is mandatory, but not only does this not cause a parse > > error, but both of them are detected: > > > > The parser in SQL is very forgiving. Does this cause some kind of problem? > > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Unexpected parsing of an invalid CREATE TABLE statement
On 6/10/19, Shawn Wagner wrote: > Consider: > > CREATE TABLE a(id INTEGER PRIMARY KEY); > CREATE TABLE b(id INTEGER PRIMARY KEY); > CREATE TABLE c(id INTEGER PRIMARY KEY, a_id, b_id, >FOREIGN KEY (a_id) REFERENCES a(id) >FOREIGN KEY (b_id) REFERENCES b(id)); > > Note the lack of comma between the two foreign key constraints in the > definition for table c. The syntax diagrams in the documentation indicate > that the comma is mandatory, but not only does this not cause a parse > error, but both of them are detected: > The parser in SQL is very forgiving. Does this cause some kind of problem? -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Unexpected parsing of an invalid CREATE TABLE statement
Consider: CREATE TABLE a(id INTEGER PRIMARY KEY); CREATE TABLE b(id INTEGER PRIMARY KEY); CREATE TABLE c(id INTEGER PRIMARY KEY, a_id, b_id, FOREIGN KEY (a_id) REFERENCES a(id) FOREIGN KEY (b_id) REFERENCES b(id)); Note the lack of comma between the two foreign key constraints in the definition for table c. The syntax diagrams in the documentation indicate that the comma is mandatory, but not only does this not cause a parse error, but both of them are detected: sqlite> PRAGMA foreign_key_list(c); id seq table fromto on_update on_delete match -- -- -- -- -- -- -- -- 0 0 b b_idid NO ACTION NO ACTION NONE 1 0 a a_idid NO ACTION NO ACTION NONE ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users