PRAGMA foreign_keys
Query, set, or clear the enforcement of foreign key constraints.
PRAGMA foreign_keys; PRAGMA foreign_keys = boolean;
On the sample database
What PRAGMA foreign_keys returns on the sample database, in SQLite 3.54.1 as built for the browser by sql.js:
| foreign_keys |
|---|
| 0 |
What the SQLite documentation says
Query, set, or clear the enforcement of foreign key constraints.
This pragma is a no-op within a transaction; foreign key constraint enforcement may only be enabled or disabled when there is no pending BEGIN or SAVEPOINT.
Changing the foreign_keys setting affects the execution of all statements prepared using the database connection, including those prepared before the setting was changed. Any existing statements prepared using the legacy sqlite3_prepare() interface may fail with an SQLITE_SCHEMA error after the foreign_keys setting is changed.
As of SQLite version 3.6.19, the default setting for foreign key enforcement is OFF. However, that might change in a future release of SQLite. The default setting for foreign key enforcement can be specified at compile-time using the SQLITE_DEFAULT_FOREIGN_KEYS preprocessor macro. To minimize future problems, applications should set the foreign key enforcement flag as required by the application and not depend on the default setting.
From sqlite.org's pragma documentation for SQLite 3.54.1, in the public domain.