Hello Sqlite-users! I have stumbled upon the fact that foreign keys are not always enforced.
Specifically, that happened when I used the INSERT statement with a SELECT clause, which apparently caused invalid values to be inserted. How else would you explain the following?: PRAGMA foreign_keys=on; CREATE TABLE parent (p1 INTEGER PRIMARY KEY); CREATE TABLE child (c1 INTEGER PRIMARY KEY REFERENCES parent(p1)); CREATE TABLE source (s1 INTEGER PRIMARY KEY); INSERT INTO parent VALUES(137); INSERT INTO source VALUES(-476); INSERT INTO child VALUES(-476); /* Gives "Error: foreign key constraint failed" as expected. Now let's try to insert the same value, -476, from the 'source' table */ INSERT INTO child SELECT * FROM source; /* No error! */ SELECT * FROM child; /* Result: -476 */ This can't be the desired behaviour, can it? _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users