On Dec 21, 2017 10:50 AM, "Simon Slavin" <slav...@bigfraud.org> wrote:
On 21 Dec 2017, at 3:46pm, David Raymond <david.raym...@tomtom.com> wrote: > The only potential problem with "insert or ignore into" is that it will ignore any constraint violation for that record insert Wait. What ? SQLite version 3.19.3 2017-06-27 16:48:08 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> CREATE TABLE MyTable (a INTEGER, CONSTRAINT noless CHECK (a > 10)); sqlite> INSERT INTO MyTable VALUES (15); sqlite> INSERT INTO MyTable VALUES (5); Error: CHECK constraint failed: noless sqlite> INSERT OR IGNORE INTO MyTable VALUES (6); sqlite> SELECT * FROM MyTable; 15 sqlite> What the hell ? Why does that work ? Isn’t it a huge bug ? How did you discover it ? My understanding is that using INSERT OR IGNORE meant that bad inserts would fail, but they would do so silently, without triggering an error result. Insert 15 succeeded, 5 failed with error, 6 failed without error. Seems exactly as advertised. What am I missing? Note that or ignore is statement specific, not transaction specific, if I understand correctly. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users