trusted_schema
Whether SQL functions and virtual tables used in the schema (views, triggers, CHECK constraints) are trusted to run.
- Par défaut
1 (on)- Range
- 0, 1
- Restart needed
- Non
- Default checked on
- SQLite 3.5x
Ce que cela fait
With it off, functions without the SQLITE_INNOCUOUS flag cannot be used from schema objects, which limits what a tampered database file can make the application execute.
Valeur par défaut
1 (on). On (a stock SQLite 3.5x build) for backwards compatibility; the SQLite documentation recommends turning it off. The sqlite3 command-line shell turns it off for its own connections, so the CLI reports 0 while a library connection reports 1.
Check the current value
PRAGMA trusted_schema; SELECT * FROM pragma_trusted_schema; -- table-valued form, usable in queries
Change it
PRAGMA trusted_schema = OFF; -- this connection only
No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When to change it
In any application that opens database files it did not create, such as user documents or downloads.
What can go wrong
Schemas that call application-defined functions not marked innocuous stop working.
Questions about trusted_schema
What is the default value of trusted_schema in SQLite?
1 (on). On (a stock SQLite 3.5x build) for backwards compatibility; the SQLite documentation recommends turning it off. The sqlite3 command-line shell turns it off for its own connections, so the CLI reports 0 while a library connection reports 1.
Does changing trusted_schema require a restart?
No. No restart. It applies at once to the connection that runs it and is lost when that connection closes, so set it every time a connection opens.
When should I change trusted_schema?
In any application that opens database files it did not create, such as user documents or downloads.
Back to all SQLite settings, or check the SQLite manual for every option.
Check trusted_schema on your own server
SQLly runs the query above against SQLite and the other engines in this reference, from one desktop app on macOS, Windows and Linux.