I'm guessing that even if you do submit an example they'll just say "you're holding it wrong" and your application code should just accept any data type everywhere and handle unexpected data types, moving complexity into your application because you can't rely on something as basic as "what I read from this column is an integer".
It's a convenient argument to make because it's not possible to give examples of bugs that never existed. I think every experienced developer can give examples of bugs caused by dynamic typing on the other hand, but I guess that doesn't count because it doesn't meet the specific criteria they asked for
Edit: It's also sneaky wording because type validation only helps you in situations where you're already trying to write invalid data e.g. after the application bug has already happened. It won't prevent application bugs because it can't. Its role is to expose them early once they've happened and mitigate the damage
Your edit is spot on the problem with trying to argue this. Type enforcement is only necessary in the database if the application happened to push the wrong type in. Fair.
I'm far more concerned about the exception and issues caused downstream by consumption of that value that was allowed to be written - possibly days or months afterward too. Which could be caught by type validation and blamed on the application yet again, sure, but at the end of the day you're throwing an unhandled exception regardless of where it surfaces.
The point of a software package is to not force me to reimplement things, I'd include type validation in that list.
(Update 2026-07-12): After nearly 5 years, nobody has yet shown me a single case where rigid type enforcement prevented an application bug. I have read many strident and emotional appeals in support of rigid type enforcement, but have seen no actual examples or real-world data. I have been confronted with a lot of doctrine, but no actual evidence.
I agree with u/Nicksaurus that you can't show bugs that never existed, so I find the devs rather... silly in this regard, even despite otherwise liking SQLite very much
That's indeed a bit silly, the whole class of issues seems fairly obvious to me: anywhere a caller assumes the column in a query result is of a specific data type. If the contract is not enforced upon insertion, the error always surfaces in the wrong location.
Lol, you can tell where their bias is even from wording. I.e., the fact that they want you to prove that strict typing prevented an issue rather than show that dynamic typing caused an issue.
And like, even then, it's just good engineering to isolate or limit the amount of variables that you can't control for as possible. ANY types are great when you need them but I don't want that to be the default.
Right. Why would I want the default to be "I want this to be an int, but actually it's an Any"?
Any types should always be explicit. Very bad things happen when developers don't realize a piece of data is untyped. But even if they are implicit, bigger bugs come when an engineer is wrong about the fact they think they know that a piece of data is typed.
This is actually worse than implicit. An argument can reasonably be made in favor of type inference, at least in programming and at least as far as certain declarations go. Even with inference of polymorphic types, at the very least you get them to be consistent (and quite well-behaved assuming parametricity). You don't have to spell it out, but once you see this being an Any, then you can see it being an int, yet you can no longer put a string in there and you're able to catch any attempt to do so quite early. Or you see any type at the input and you know the output has the exact same type. You don't just let it blow up at runtime or run arbitrary implicit conversions trying to make sense of it.
Exactly. I'm a big fan of type inference in situations where I know it's happening and my IDE can tell me what's going on (realistically, most people don't need to code in Notepad, and I'm OK with sacrificing clarity of notepad for simplicity in VSCode or equivalent).
But when my tools say "this is an int", it better damn well be an int. The human brain isn't coded to break patterns - When you read a subroutine that says it takes an int, it takes a lot more work for you to reason out what'd happen if it received a string or an array than if it said "any".
This is why typescript often ends up being a double-edged sword - I still prefer writing it to javascript, but you have to use a good linter and properly inspect data when you injest it or else it becomes poisonous to your ability to follow code awfully quickly.
I suppose SQLite is the same thing, in that you should endeavor to know your toolchain and understand where the pitfalls going to be, but SQLite actively chooses to sharpen the side that's going to cut you if you don't handle it perfectly.
I actually was using SQLite when I was first starting out, and basically wrote something to pull in messy data into it with a try/except type block. Not awesome code, but it was functional. Or... it would have been had SQLite actually enforced types. I burned like, several hours thinking I'd finally gotten some clean data only to discover it was just letting me put garbage anywhere lol
That's the funny part too, there are less than 100 usages of void period in the SQLite source code. At reasonable location; module loading boundaries & malloc/free.
The source code heavily uses typed pointers everywhere.
Thanks, I actually wanted to check before writing the comment. Anyway, there are still other ways of violating type safety, but type safety lies on a spectrum.
It's too old for Javascript :D (Yes, I know Javascript is older -- 1995 vs. 2000 for the first Sqlite version. But no one was using it outside the browser until c. 2009 when Node was released.)
View all comments
130
u/ric2b Jul 12 '26
The SQLite devs are so skeptical that type enforcement is useful at all that they even ask people to share any examples of STRICT tables preventing a bug: https://sqlite.org/flextypegood.html#if_you_insist_on_rigid_type_enforcement_
I'm guessing that even if you do submit an example they'll just say "you're holding it wrong" and your application code should just accept any data type everywhere and handle unexpected data types, moving complexity into your application because you can't rely on something as basic as "what I read from this column is an integer".