4 ms·
If type safety is so great, why isn’t sql statically type checked
by oceanswave 9y ago
If type safety is so great, why isn’t sql statically type checked
- majewsky 9y agoSQL is statically type-checked, at least in Postgres. postgres=# SELECT * FROM domains WHERE id = 'foo'; ERROR: invalid input syntax for integer: "foo" LINE 1: SELECT * FROM domains WHERE id = 'foo'; ^
- cpfohl 9y agoNot just PostGres. That's standard SQL. Columns have data types. Tables have schemata. Schemata are very strongly typed. Can't insert a 'full_name' column into a table without such a column.
- da_chicken 9y agoUnless you're talking about SQLite, SQL RDBMSs are both static and strongly typed. The systems typically do allow some implicit type conversions, but type is critical to how a table works.
- lmm 9y agoBecause SQL predates a lot of modern techniques. A ground-up replacement written today probably would be statically type checked.