Top stories
The case for SQLite STRICT tables
- Category: Engineering post
- Status: discussion
- Sources: Evan Hahn, HN discussion
- Summary: A best-practice post argues for declaring SQLite tables
STRICTso the engine rejects type mismatches (for example inserting text into anINTEGERcolumn) instead of applying flexible type affinity. STRICT tables were added in SQLite 3.37.0 (November 2021). TheANYcolumn type preserves flexible storage where needed. Caveats: converting an existing table needs a migration, STRICT is unavailable before 3.37.0, and the SQLite developers themselves favor flexible typing. This is guidance, not a new feature. - Why it matters: Default SQLite typing silently coerces or stores mismatched values, and STRICT turns a class of data-integrity bugs into insert-time errors.