On 2017/06/28 2:51 PM, Simon Slavin wrote:

An explicit NULL works only for the autoincrement column, but not for default 
values.
Really ?  In that case I withdraw my previous answer.  I thought that NULLs 
were converted to the default value for a column (which is usually NULL but can 
be overridden with a DEFAULT clause).  Thanks for the correction.

if this was the case, how would you insert values which you WANT to be NULL into a DB?

The only time a NULL gets converted is for a Primary Key Auto-increment column, because those can ever be NULL (except of course in SQLite's case, but the exception survived for other legacy reasons).

I did ponder whether it would be a nice "feature" to use the default if both a DEFAULT and a NOT NULL constraint existed on a column - but then again, that will go against strict design principles and can cause a lot of confusion later.

Omitting a column from the Insert prototype or specifying DEFAULTS for it will do the trick in SQLite - I'm not entirely sure if this holds true for all other SQL DB systems, but I suppose strictly it should.

Cheers,
Ryan

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to