Oliver Peters <oliver....@web.de> wrote: > Please believe me I really try hard to understand - but what I don't > understand > is the fact that you can insert in this case: > > > PRAGMA foreign_keys = ON; > > /* > **success INSERT = yes > */ > > CREATE TABLE a( > id INTEGER PRIMARY KEY > AUTOINCREMENT, > id_staff_editor INTEGER NOT NULL, > FOREIGN KEY(id_staff_editor) REFERENCES a(id) > ); > > INSERT INTO a(id_staff_editor) VALUES(1); > > > The table is empty, there is no record and as far as I understand I'm doing > the > following > > Insert into the field id_staff_editor of table a the value 1 if the value 1 is > already present in the field id of table a (but in the moment there is no > record > in table a)
The actual implementation is more like: insert the record, then check constraints - if they fail, roll back the insertion and raise an error. > To my mind the concept of Foreign Keys means that you check before > INSERT/UPDATE Why would you want to fail statements that end up not violating any constraints? -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users