On 8/7/18, Dirkjan Ochtman <[email protected]> wrote:
>
> If INTEGER PRIMARY KEYs are always NOT NULL, I'd reasonably expect that it
> will be `notnull` even if NOT NULL is not explicitly specified. Is this a
> bug?

I don't think so.  INTEGER PRIMARY KEYs have another magic property in
that if you insert a NULL into them, they automatically convert that
NULL into a valid integer primary key.  So  the "notnull" column in
PRAGMA table_info does not mean "is this column always non-null when
read" but rather as "is it an error to insert a NULL into this
column".  For ordinary columns that are marked NOT NULL, the answer
will be "yes" according to both meanings.  But for an INTEGER PRIMARY
KEY, the answer according to the second meaning is "no".

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

Reply via email to