Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more expressions for selected statements #242

Merged
merged 6 commits into from
Jun 12, 2024

Conversation

dey4ss
Copy link
Member

@dey4ss dey4ss commented Jun 3, 2024

As raised in #213 and discussed in #215, some valid expressions, such as negative numbers, are not supported by the INSERT statement. Thus, this PR carefully extends the range of expressions allowed in the INSERT statements, but also in EXECUTE statements and in hints.

I looked into SQL:2023 to see which expressions are allowed inside the VALUES list of an INSERT statement, and there are a lot of valid alternatives in the standard. Some of them are collected in the following:

-| <scalar subquery>
-| <case expression>
+| <cast specification>
 | <boolean value expression>
 | <numeric value expression>
 | <string value expression>
 | <datetime value expression>
 | <interval value expression>
-| <user-defined type value expression>
-| <reference value expression>
-| <collection value expression>
-| <JSON value expression>

Note that all of this is scattered accross many pages and places as part of complex hierarchies. I collected just a few possibilities here. I marked newly supported (+) and some unsupported (-) alternatives. Furthermore, this PR also allows for signed numerical/interval expressions (a.k.a unary minus of numeric/interval). Cast expressions are restricted to only take other allowed expressions as input.

Besides, this PR updates the CI runners to Ubuntu 24.04 and uses its shipped clang/gcc versions. While checking the runners, I noticed that (i) there was an issue with the member variable introduced in #240 and (ii) that did not cause the CI to fail. I sneaked in fixes for both.

fixes #215

@sandrain
Copy link

Looking forward to seeing this patch land. 👍

Copy link
Contributor

@Bouncner Bouncner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@dey4ss dey4ss merged commit 1969a3c into master Jun 12, 2024
4 checks passed
@dey4ss dey4ss deleted the dey4ss/extended_literals branch June 12, 2024 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Correct Handling of Negative Numerical Literals
3 participants