Skip to content

allow SPQ cast of null to any type#6666

Merged
nwt merged 1 commit intomainfrom
null-cast
Feb 26, 2026
Merged

allow SPQ cast of null to any type#6666
nwt merged 1 commit intomainfrom
null-cast

Conversation

@nwt
Copy link
Member

@nwt nwt commented Feb 26, 2026

Since removal of typed nulls in #6633, a cast in SPQ of null to any type other than null or a nullable union (i.e., a union containing null) results in an error. Since SQL allows a cast of null to any type, do likewise in SPQ with the result of a cast to a non-null type being a nullable union containing the null value. For example, the result of null::int64 is null::(int64|null).

Note that SUP retains the restriction that null can be cast only to null or a nullable union.

Fixes #6658.

@nwt nwt requested a review from a team February 26, 2026 19:29
Since removal of typed nulls in #6633, a cast in SPQ of null to any type
other than null or a nullable union (i.e., a union containing null)
results in an error.  Since SQL allows a cast of null to any type, do
likewise in SPQ with the result of a cast to a non-null type being a
nullable union containing the null value.  For example, the result of
`null::int64` is `null::(int64|null)`.

Note that SUP retains the restriction that null can be cast only to null
or a nullable union.
@nwt nwt merged commit 43a111b into main Feb 26, 2026
3 of 4 checks passed
@nwt nwt deleted the null-cast branch February 26, 2026 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL: CAST of NULL to INTEGER produces an error value

2 participants