sqlite foreign keys not enforced by default
SQLite 3.45. I defined REFERENCES users(id) on a table but I can insert rows with a nonexistent user id and SQLite accepts it. I thought foreign keys were enforced. Do I need to turn something on? I assumed constraints were part of the schema and would just work, so this was an unpleasant surprise. The inserts happen from a background importer as well as the app, so I need a fix that covers both paths.
4 replies