3 ms·
> Also, column types are not checked and you can easily insert a string into numeric column. This is only true if you don't use strict tables (implemented end
by Timon3 3y ago
> Also, column types are not checked and you can easily insert a string into numeric column.
This is only true if you don't use strict tables (implemented end of 2021): https://www.sqlite.org/stricttables.html https://www.sqlite.org/stricttables.html
If you define a table as strict, the data is coerced, and if not successful an error is thrown.
- mickeyp 3y ago> If you define a table as strict, the data is coerced, and if not successful an error is thrown. Coercing the data is hardly better. Now you have data integrity issues and you have no errors!
- Sammi 3y agoSQLite attempts to coerce the data into the appropriate type using the usual affinity rules, as PostgreSQL, MySQL, SQL Server, and Oracle all do. If the value cannot be losslessly converted in the specified datatype, then an SQLITE_CONSTRAINT_DATATYPE error is raised. https://www.sqlite.org/stricttables.html https://www.sqlite.org/stricttables.html
- IshKebab 3y ago> the data is coerced Seriously? And there I was thinking they actually fixed this mistake... they just made another schoolboy error.
- Mawr 3y agoTo clarify the bit about coercion: "SQLite attempts to coerce the data into the appropriate type using the usual affinity rules, as PostgreSQL, MySQL, SQL Server, and Oracle all do."