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 parsing of CREATE TABLE t AS (...) UNION (...) #277

Merged
merged 1 commit into from
Sep 29, 2023

Conversation

nicktobey
Copy link

This allows parsing of CREATE TABLE AS statements when the expression being used to create the table is a set operation like UNION, INTERSECT, or EXCEPT.

The "AS" keyword is typically optional. But this change only allows set ops to be used with CREATE ... AS when the AS is explicit. This is to avoid an ambiguity in the current grammar when attempting to parse CREATE TABLE t (, where what follows could be a set op or a table definition. Fully matching MySQL's spec here would require rewriting our grammar to avoid this ambiguity, which is outside the scope of the PR. However, this PR makes us strictly more correct than we were before.

@nicktobey nicktobey requested a review from jycor September 25, 2023 17:13
@nicktobey nicktobey requested a review from zachmu as a code owner September 25, 2023 17:13
Copy link

@jycor jycor left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

Choose a reason for hiding this comment

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

Was this file meant to be added? I didn't look at the contents yet, but the name sounded suspicious 😉

Copy link
Author

Choose a reason for hiding this comment

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

Whoops! That's the debug output from yacc. It shouldn't be there.

@nicktobey nicktobey merged commit 6c60b48 into main Sep 29, 2023
@nicktobey nicktobey deleted the nicktobey/createas branch September 29, 2023 00:02
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.

3 participants