Null cast definition in ansi sql?

Viewed 64

Is there a standard for how the NULL value can be cast? It seems there are two implementations, one being "anything", and the other being "to anything the first time, then the type must be consistent with the first type". For example:

BigQuery (limited)

SELECT CAST(CAST(NULL AS STRING) AS ARRAY<STRING>)

Invalid cast from STRING to ARRAY at [1:13]

Postgres (anything)

postgres=# select null::varchar::varchar[][][][];
OK

SQLServer (anything)

SELECT cast(cast(cast(try_cast('asdf' as integer) as integer) as DateTime) as DateTime)
0 Answers
Related