Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If type safety is so great, why isn’t sql statically type checked


SQL 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';
                                           ^


Not 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.


Unless 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.


Because SQL predates a lot of modern techniques. A ground-up replacement written today probably would be statically type checked.


What do you guys think the schema is?


Dynamic




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: