3 ms·
SQLite uses dynamic types? Is this an issue in practice, especially for large apps? Don't you lose guarantees about your data which makes it messy to handle on
by seanwilson 4y ago
SQLite uses dynamic types? Is this an issue in practice, especially for large apps? Don't you lose guarantees about your data which makes it messy to handle on the backend?
Context from https://www.sqlite.org/datatype3.html https://www.sqlite.org/datatype3.html: "SQLite uses a more general dynamic type system. In SQLite, the datatype of a value is associated with the value itself, not with its container. The dynamic type system of SQLite is backwards compatible with the more common static type systems of other database engines in the sense that SQL statements that work on statically typed databases work the same way in SQLite. However, the dynamic typing in SQLite allows it to do things which are not possible in traditional rigidly typed databases. Flexible typing is a feature of SQLite, not a bug."
- aliswe 4y agoThis sounds like schemalessness to me? serious "question".
- jamie_ca 4y agoNot schemaless, but typeless. SQLite will let you declare a column to be an integer and then dump a string into it, but you're still defining a table with specific columns. It's like the opposite problem Mysql has when you try to write data larger than the field definition - Mysql will truncate, Sqlite will store the data you gave it.
- seanwilson 4y agoTypeless is the default though? Why wouldn't you want the types to be reliable when you're reading/writing from the backend in the general case?
- mbreese 4y agoI believe typeless is the default because of largely historical reason. Namely, typeless was the original mode and strict mode was added later. But, that’s not the only reason. There is a whole page on why typeless is a feature and not a bug. https://sqlite.org/flextypegood.html https://sqlite.org/flextypegood.html
- ripley12 4y agoYou can use SQLite in strict mode if you prefer. https://www.sqlite.org/stricttables.html https://www.sqlite.org/stricttables.html