On Wednesday, February 13, 2019, 11:06:07 PM, Thomas Kurz
<[email protected]> wrote:

>> I guess a missing DEFAULT automatically implies DEFAULT NULL, so
>> the behavior of ALTER should be correct whilst CREATE seems to
>> forget to reject the statement.

I suspect the difference is you can CREATE a NOT NULL column with an
(implied) DEFAULT NULL because there are no rows yet, and so long as
you always supply a NOT NULL value when INSERTing, nothing is
violated. However, when trying to add a NOT NULL (implied) DEFAULT
NULL column, any _existing_ rows would violate the condition (since
their values for the new column would be NULL) so it cannot be
allowed. In theory, I think it _could_ be allowed if the table is
empty (but I don't know whether SQLite checks this).



_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to