What does STRICT mode change in a SQLite table?
Quick answer
SQLite STRICT mode adds stricter type checking to an individual table: every column must declare a type, and each declared type must be INT, INTEGER, REAL, TEXT, BLOB, or ANY. SQLite still tries its usual affinity conversions, but rejects values it cannot convert losslessly. STRICT requires SQLite 3.37.0 or later; it does not replace constraints such as NOT NULL or CHECK. [S1]
The question, the details, the next step.
A practical checklist
Confirm the SQLite runtime that will open the database is version 3.37.0 or later.
Use only INT, INTEGER, REAL, TEXT, BLOB, or ANY for STRICT column types.
Check whether inputs can be losslessly converted to each declared type.
Use ANY only where accepting values of any storage class without coercion is intentional.
Add separate constraints such as NOT NULL or CHECK where needed.
Use INTEGER PRIMARY KEY, not INT PRIMARY KEY, when rowid alias behavior is intended.
A few more useful answers
Does STRICT automatically make every column NOT NULL?
No. NULL is allowed unless a separate rule, such as NOT NULL, prohibits it. [S1]
Can I turn on STRICT for just one column?
STRICT is a table option, so it applies to the table, not to an individual column. [S1]
Does STRICT replace CHECK or foreign-key constraints?
No. Those and other ordinary table behaviors continue to work as before; add the constraints your schema requires. [S1]
Sources
References used for this guide.
- [S1] STRICT Tables sqlite.org · Checked
