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

feat: add support for snowflake merge statements #1887

Merged
merged 3 commits into from
Nov 10, 2023

Conversation

davidjgoss
Copy link
Contributor

@davidjgoss davidjgoss commented Nov 8, 2023

This PR changes the parser to account for some Snowflake-specific aspects of the MERGE statement, namely:

See Snowflake's docs on MERGE: https://docs.snowflake.com/en/sql-reference/sql/merge - the new tests are derived from that doc.


With the ON logic, I did the simplest parser change which for existing cases (i.e. with parens), will now result in the onCondition being a Parenthesis containing the expression, where before it would have just been the expression (e.g. EqualsTo or whatever) itself. This feels innocuous to me, but if we consider this a breaking change and would prefer to avoid it, I can refactor to ensure full backwards compatibility, perhaps by adding a choice point in the parser and retaining the presence/absence of original parens as a boolean.

Adds support for the ON clause of a MERGE statement to be without
enclosing parens, as is the convention in Snowflake.
@manticore-projects manticore-projects merged commit 36b806d into JSQLParser:master Nov 10, 2023
@davidjgoss davidjgoss deleted the feat/snowflake-merge branch November 10, 2023 06:31
@davidjgoss
Copy link
Contributor Author

Thanks for merging @manticore-projects! Do you know when this might be released?

@manticore-projects
Copy link
Contributor

This depends fully on @wumpz who is under serious time constraints.
We could aim for an EoY release though.

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.

[FEATURE] MERGE ON without () Snowflake MERGE statement does not require parentheses around the ON statement
2 participants