A Primary Key cannot be null. Except in cases of bug-for-bug backwards compatibility. WITHOUT ROWID tables comply with the SQL specification, not the bug-for-bug compatibility mode of rowid tables where due to an age old error nulls are allowed in primary keys although they should not be.
--- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Shane Dev >Sent: Friday, 19 January, 2018 01:32 >To: SQLite mailing list >Subject: [sqlite] "Error: NOT NULL constraint failed ..." when no >such constraint exists > >Hello, > >The following SQL works as I expect - > >sqlite> CREATE TABLE edges(parent int, child int, primary key(parent, >child)); >sqlite> insert into edges select null, 1; >sqlite> select * from edges; >parent child > 1 >sqlite> > >but if I remove the superfluous rowid column from the table >definition - > >sqlite> drop table edges; >sqlite> CREATE TABLE edges(parent int, child int, primary key(parent, >child)) without rowid; >sqlite> insert into edges select null, 1; >Error: NOT NULL constraint failed: edges.parent >sqlite> > >Why do I get this error? >_______________________________________________ >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