SQLite stores text in a number column. The word STRICT stops it.
4 months ago
Declare a column in SQLite as a number, and the database will still let you store the word garbage in it. No error. No warning.
Ask about this presentation
Chapters
Show transcriptHide transcript
Declare a column in SQLite as a number, and the database will still let you store the word garbage in it. No error. No warning.
The type you declared is a preference, not a rule. So the wrong value slips in silently. Add one keyword, STRICT, and that same insert fails. It cannot store text in an integer column. Every other serious database already does this by default.
That's the whole change. The word STRICT, right after the closing parenthesis. It's been in SQLite since twenty twenty-one, and most builders have still never used it.
A strict table accepts only six real types, and every column must name one. Made-up types like datetime or uuid sail through by default, though SQLite has no such types. Strict rejects each at create time.
Here's the catch people miss. Strict blocks lossy values, not all coercion. The string one-two-three still goes into an integer column, because it converts cleanly. Only values that can't convert are refused. Narrower than it looks, and that's on purpose.
Two sharp edges. You can't convert an existing table. You build a new one and copy the rows, and the copy fails if the old data is already wrong. And there's a hard version floor. An older SQLite can't even read a database that contains a strict table.
So why isn't it the default? A common reaction is that it simply should be. But SQLite's own developers keep flexible typing on purpose, and defend it, for key-value stores and messy imports where mixed types are the point. A genuine two-sided choice.
So the takeaway. A free, one-word upgrade to data integrity on new tables today, with a couple of edges worth knowing.
Up next
1:48Writing a note down as one thing is what made it fast
@the-daily-build
3 months ago
1:51Nothing on the rig measures speed
@the-daily-build
3 months ago
1:53A file gets smaller when you can guess what is in it
@the-daily-build
3 months ago
1:55The seal on an AI's private thinking had one key for the whole company
@the-daily-build
3 months ago
1:50One row for every sellable unit, and each checkout takes any free one
@the-daily-build
3 months ago
1:42A single CPU instruction, stretched from a blink to a full minute
@the-daily-build
3 months ago
1:44You can't be best at everything
@the-daily-build
3 months ago
1:42How deleting one if-statement made this filter 4x faster
@the-daily-build
3 months ago
1:42Software gives you five skin tones, or sixteen million
@the-daily-build
3 months ago
1:43A Self-Spreading Worm Got Into the Code Behind Billions of Installs
@the-daily-build
3 months ago
1:34The AI session you can’t take with you
@the-daily-build
3 months ago
1:42He Walked Through His House Before It Was Built, at Full Size, in a Headset
@the-daily-build
4 months ago







