On 28 Nov 2017, at 3:26pm, x <tam118...@hotmail.com> wrote: > If I have foreign keys in place but always have foreign_keys = OFF then one > day start SQLite with foreign_keys = ON what happens? Does SQLite suddenly > check all foreign keys and report / delete violations or does it leave > everything as is and just enforce foreign keys from that point on?
No. There is no automatic check. If you have broken a foreign key constraint while "foreign_keys = OFF" it may only be discovered some time in the future, or it may live on for as long as the database is used. However, you can force SQLite to check all foreign keys any time you want using <https://sqlite.org/pragma.html#pragma_foreign_key_check> PRAGMA foreign_key_check If it returns no rows, then there are no problems. This check will work even while "foreign_keys = OFF", so you can check it before you turn that PRAGMA back on. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users