>>>>> Clemens Ladisch writes: >>>>> Ivan Shmakov wrote:
>> I wonder if I'm on safe side when I use, say: >> INSERT OR IGNORE INTO "foo" ("foo") >> VALUES (?1); >> I mean, if the first INSERT fails for the reason other than the >> UNIQUE constraint set > <http://sqlite.org/lang_conflict.html> says: > | The ON CONFLICT clause applies to UNIQUE and NOT NULL constraints […] > If it fails for any other reason, you get a normal error. The point is that I have a NOT NULL constraint as well: >> CREATE TABLE "foo" ("foo" TEXT NOT NULL); (There was a missing UNIQUE in CREATE INDEX, BTW.) However, as it's clear to me now, the second INSERT as specified won't raise an error should there be no ?1 in "foo". Thus, I need something like the following instead: INSERT OR IGNORE INTO "foo" ("foo") VALUES (?1); INSERT INTO "bar" ("foo") VALUES ((SELECT f."rowid" FROM "foo" f WHERE f."foo" = ?1)); Or is there a better way to ensure that the inner SELECT either returns a single row, or fails? TIA. -- FSF associate member #7257 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users