This is the line that create the violation: sprintf(s, "insert into a values(%d, 'The name field for %d', %d)", NROWS+i, i, NROWS+i+VIOLATION);
if VIOLATION is 0 then you are inserting a record with id = NROWS+i and aid = NROWS+i. Since the referential constraint is that aid references id in the same table, it is satisfied by the record itself, thus the constraint is not violated. --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-----Original Message----- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Dominique Devienne >Sent: Thursday, 2 August, 2018 01:48 >To: General Discussion of SQLite Database >Subject: Re: [sqlite] Violated failed foreign key constraint delays >the rest of transaction ; Some foreign key violations don't trigger >the error at all > >On Thu, Aug 2, 2018 at 9:35 AM Keith Medcalf <kmedc...@dessus.com> >wrote: > >> You observe no violation when VIOLATION is 0 because there is no >> referential integrity violation to report ... >> > >Really Keith? Parent IDs are in range [0, NROWS) >Child/FK IDs inserted are in range [NROWS, 2*NROWS) >How's that not an FK violation? At least that's how I read the code. >Am I >reading wrong? --DD >_______________________________________________ >sqlite-users mailing list >sqlite-users@mailinglists.sqlite.org >http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users