![]() Sqlite> CREATE TABLE parent (a INTEGER PRIMARY KEY, b INTEGER, c, UNIQUE (a, b)) INSERT INTO parent (b) VALUES ('987654321') RETURNING a Now that I know that FOREIGN KEY just works, I've found the source of the original problem: sqlite> PRAGMA foreign_keys = ON ĬREATE TABLE parent (a INTEGER PRIMARY KEY, b, c, UNIQUE (a, b)) ĬREATE TABLE child (d INTEGER PRIMARY KEY, e, f, FOREIGN KEY (d, e) REFERENCES parent(b, a)) And the reason was I've switched to working on a semi equivalent example instead of the original point of the problem and made errors in translation. Change it to INSERT INTO child (e, f, g) VALUES (1, 1, 3) and it works.Īw, thank you! It seems I've just needed a second pair of eyes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |