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
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
sqlite-users mailing list