On February 13, 2019 5:32:09 PM EST, Thomas Kurz <[email protected]> wrote:
>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
>[email protected]
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

This is a limitation of SQLite's current ALTER TABLE implementation. Columns 
can only be added with a default value of NULL, therefore NOT NULL columns are 
forbidden. 
-- 
J. King
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to