News for hackers. Stuff that matters.
Re:Rethinking Database Programming by groundzeros2015 on Tuesday August 18, 2026 @10:36AM (#49346253)
SQL is end to end type safe.
Re:Rethinking Database Programming by sharno on Tuesday August 18, 2026 @11:20AM (#49346992)
Which end? This moves one end to reach frontend code
Re:Rethinking Database Programming by bazoom42 on Tuesday August 18, 2026 @11:07AM (#49346755)
Isn’t sql weakly typed? Or does this depend on the engine?
Re:Rethinking Database Programming by groundzeros2015 on Tuesday August 18, 2026 @12:11PM (#49347896)
SQLite is the only one I know of that doesn’t enforce types by default, but I don’t know what the SQL spec requires.
Re:Rethinking Database Programming by pjmlp on Tuesday August 18, 2026 @03:49PM (#49351630)
No 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.

Re:Rethinking Database Programming by bazoom42 on Wednesday August 19, 2026 @03:45AM (#49358304)
What happens if a query compares a string to a number?
Re:Rethinking Database Programming by mike_hearn on Wednesday August 19, 2026 @04:08AM (#49358523)
You get a type error from the database.
Re:Rethinking Database Programming by bazoom42 on Wednesday August 19, 2026 @11:50AM (#49363164)
As far as I can tell, some engines will implicitly coerce types so “7” = 7
Re:Rethinking Database Programming by moljac024 on Thursday August 20, 2026 @03:37AM (#49371567)
But 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.

Re:Rethinking Database Programming by victorbjorklund on Tuesday August 18, 2026 @12:45PM (#49348448)
Only backend to database. This is talking about typesafe from database - backend - frontend.
Re:Rethinking Database Programming by groundzeros2015 on Tuesday August 18, 2026 @12:55PM (#49348646)
Yes, 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.

Re:Rethinking Database Programming by rzmmm on Tuesday August 18, 2026 @02:16PM (#49350053)
You 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
Re:Rethinking Database Programming by fulafel on Wednesday August 19, 2026 @01:56AM (#49357429)
They might mean static typing in queries.