Skip to content

foreign_keys, recursive_triggers, user_version, application_id ​

These settings describe connection behavior or application-managed database identifiers. They are not accepted by the server SET command.

Settings ​

Setting Type Default Meaning
application_id Int32 0 Application-managed database file identifier.
foreign_keys Bool 0 Enforce foreign-key constraints in database sessions.
recursive_triggers Bool 0 Allow triggers to invoke themselves recursively.
user_version Int32 0 Application-managed database schema version.

Change a value ​

Use PRAGMA name = value for the corresponding connection flag or database-header field. To save server database defaults and apply them to other clients, write validated name/value rows to system.settings. SET does not accept these four names.

For example, persist foreign-key enforcement for the selected server database with:

sql
INSERT OR REPLACE INTO system.settings(name,value) VALUES('foreign_keys','1');
sql
PRAGMA foreign_keys FORMAT csv;
text
1
sql
SELECT name,value FROM system.settings WHERE name IN ('foreign_keys','recursive_triggers','user_version','application_id') ORDER BY name FORMAT csv;
text
"application_id","0"
"foreign_keys","1"
"recursive_triggers","0"
"user_version","0"

Scope ​

A PRAGMA changes the observing connection's flag or database-header field according to its SQL contract. A validated system.settings write stores server database defaults for later requests by clients selecting that database. Such management writes require autocommit and no active transactions in the database.

See database settings and SET for the separate SET-supported names.