Tell HN: Cast('abc' AS INTEGER) returns 0 in SQLite 1 points by prmph 2d ago ↗ HN Every day I encounter more weirdness of SQLite. Is this the JavaScript of databases?
[–] hans_castorp 2d ago ↗ There is more: https://dbfiddle.uk/FDkqamR_(Some examples there no longer work with the current version - so they are improving :) )This is by design and well documented though.
[–] vconnor 2d ago ↗ What do you want it to return? You should really RTFM of SQLite. It's by design. [–] prmph 2d ago ↗ It is not a good design. It should throw an error. [–] stefanos82 2d ago ↗ Then declare your table(s) as strict; that should solve your issues.https://sqlite.org/stricttables.html [–] prmph 2d ago ↗ Even with STRICT, explicit CAST() has the same problem. [–] hans_castorp 2d ago ↗ But strict isn't supported if you are using exotic data types like DATE or TIMESTAMP
[–] prmph 2d ago ↗ It is not a good design. It should throw an error. [–] stefanos82 2d ago ↗ Then declare your table(s) as strict; that should solve your issues.https://sqlite.org/stricttables.html [–] prmph 2d ago ↗ Even with STRICT, explicit CAST() has the same problem. [–] hans_castorp 2d ago ↗ But strict isn't supported if you are using exotic data types like DATE or TIMESTAMP
[–] stefanos82 2d ago ↗ Then declare your table(s) as strict; that should solve your issues.https://sqlite.org/stricttables.html [–] prmph 2d ago ↗ Even with STRICT, explicit CAST() has the same problem. [–] hans_castorp 2d ago ↗ But strict isn't supported if you are using exotic data types like DATE or TIMESTAMP
[–] hans_castorp 2d ago ↗ But strict isn't supported if you are using exotic data types like DATE or TIMESTAMP
9 comments
[ 0.17 ms ] story [ 30.1 ms ] thread(Some examples there no longer work with the current version - so they are improving :) )
This is by design and well documented though.
https://sqlite.org/stricttables.html