|
|
|
|
|
by mytherin
1235 days ago
|
|
Most implementations of SQL are not dynamically typed - they are statically typed. There is an explicit compilation phase (`PREPARE`) that compiles the entire plan and handles any type errors. For example - this query throws a type error when run in Postgres during query compilation without executing anything or reading a row of the input data: CREATE TABLE varchars(v VARCHAR);
PREPARE v1 AS SELECT v + 42 FROM varchars;
ERROR: operator does not exist: character varying + integer
LINE 1: PREPARE v1 AS SELECT v + 42 FROM varchars;
^
HINT: No operator matches the given name and argument types. You might need to add explicit type casts.
The one notable exception to this is SQLite which has per-value typing, rather than per-column typing. As such SQLite is dynamically typed. |
|