Hi everyone,

It seems that upsert does not take into account "NOT NULL" constraints. In
the example below, I get an error "NOT NULL constraint failed: test.c0":

CREATE TABLE test (c0 NOT NULL);
INSERT INTO test(c0) VALUES (NULL) ON CONFLICT DO NOTHING;

I would have expected that the second statement has the same effect as the
following statement, which would also be confirmed by the docs [1]:

INSERT OR IGNORE INTO test(c0) VALUES (NULL);

The example seems to work for the UNIQUE and PRIMARY KEY constraints.

Best,
Manuel

[1] "A DO NOTHING upsert without a conflict target works the same as an
INSERT OR IGNORE." at https://sqlite.org/lang_UPSERT.html
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to