You should probably read the documentation. https://sqlite.org/lang_altertable.html
--- 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 Thomas Kurz >Sent: Wednesday, 13 February, 2019 15:32 >To: SQLite mailing list >Subject: [sqlite] inconsistent behavior when creating INTEGER NOT >NULL column without DEFAULT? > >I just stumbled upon the following issue (tested with 3.27.1): > >I can do this: >CREATE TABLE test (groupid INTEGER NOT NULL REFERENCES mygroup (id) >ON UPDATE CASCADE ON DELETE CASCADE); > >But this fails: >ALTER TABLE test ADD COLUMN groupid2 INTEGER NOT NULL REFERENCES >mygroup (id) ON UPDATE CASCADE ON DELETE CASCADE; > >--> Error: Cannot add a NOT NULL column with default value NULL > >I think both variants should behave consistently. But I don't know >which behavior is the correct one according to the SQL standard. > > >_______________________________________________ >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