6 ms·
The point is end to end type safety. Whether that is worth the tradeoff of losing direct developer access to the db primitives is another question.
by alpinisme 1mo ago
The point is end to end type safety. Whether that is worth the tradeoff of losing direct developer access to the db primitives is another question.
- whattheheckheck 1mo agoI agree with end to end type safety but that needs more details to sell what problem its solving. Folks dont buy it for itself
- groundzeros2015 1mo agoSQL is end to end type safe.
- bazoom42 1mo agoIsn’t sql weakly typed? Or does this depend on the engine?
- groundzeros2015 1mo agoSQLite is the only one I know of that doesn’t enforce types by default, but I don’t know what the SQL spec requires.
- pjmlp 29d agoNo it is strongly typed, there is no accident that all PL extensions to the base query language have such a Ada/Pascal similarity. Additional DML has plenty of options to enforce rules that keep data consistency. While they make the life harder to delete/update/insert items in specific sequences, they can save the day on bad queries.
- bazoom42 29d agoWhat happens if a query compares a string to a number?
- mike_hearn 29d agoYou get a type error from the database.
- bazoom42 29d agoAs far as I can tell, some engines will implicitly coerce types so “7” = 7
- moljac024 28d agoBut when do you get that type error? This is the important bit. You get it after the app is deployed, the query is ran and a result is expected. When do I get a type error from my language if it's statically typed? That's right, before I even deploy.
- sharno 1mo agoWhich end? This moves one end to reach frontend code
- victorbjorklund 1mo agoOnly backend to database. This is talking about typesafe from database - backend - frontend.
- groundzeros2015 29d agoYes, and that’s an architectural choice you’re making. Instead of using all the consistencies provided in the database process - including types, but also date/time, constraints, transactions, triggers etc. you are exiting the system and losing all guarantees. This system also doesn’t solve that problem.
- rzmmm 29d agoYou can write raw sql and use the "describe" clause in script, and then generate code with the result. This gives full db-backend-frontend type safety with raw sql queries
- fulafel 29d agoThey might mean static typing in queries.