3 ms·
SQLite is awesome. I've always been a bit confused by the design decision for SQLite to allow you to store any value in any column despite the column's type, b
by justin_oaks 6y ago
SQLite is awesome.
I've always been a bit confused by the design decision for SQLite to allow you to store any value in any column despite the column's type, but I've never had that been a problem since my applications don't try to store strings in integer columns.
It's a similar situation for storing date types as strings. Seems like an odd choice, but I've never had a problem because I keep my date types consistent.
It just goes to show that seemingly odd design choices might never end up being a problem.
I'd be fascinated to hear from those who may have had problems with SQLite's "flexible" type system.
- SPBS 6y agoI mean countless critical systems run on Excel spreadsheets and they're the definition of dynamically typed values, so there's some precedent for that working in the real world
- qppo 6y agoThere's also a cottage industry predicated on unbundling and (for the most part) statically typing processes defined in excel spreadsheets.
- to11mtm 6y agoSo, I've thought about this a lot, especially since there are sometimes some challenges with things such as datetimes in SQLite if you're not very careful and specific (thinking about if you actually want to use in query for more than basic comparisons). However, on the OTHER hand... if we think about SQLite as a general purpose data storage tool, it's actually a really handy feature, letting the in datatypes almost every case be more of an additional type of label. For example, if I required a high-precision timestamp, I could declare the column type something like 'UTCEpochNanos', providing a reminder to myself and other consumers of the data how it should be interpreted.