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

Fix PostgreSQL set operation precedence #3567

Merged
merged 3 commits into from
Jul 19, 2023

Conversation

tisonkun
Copy link
Contributor

Comes from #2378 (comment).

PG treats set ops in different precedence - INTERSECT is tighter than UNION and EXCEPT.

Signed-off-by: tison <wander4096@gmail.com>
…select_with_parens

Signed-off-by: tison <wander4096@gmail.com>
@tisonkun
Copy link
Contributor Author

test locally with mvn test under pg path and it passes all.

@tisonkun
Copy link
Contributor Author

cc @OleksiiKovalov @KvanTTT @parrt

@tisonkun
Copy link
Contributor Author

@teverett is Windows build unstable? I check the CI log and it seems all about package installing instead of tests failure.

Copy link
Member

@KvanTTT KvanTTT left a comment

Choose a reason for hiding this comment

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

Please add a test that covers suggested changes.

sql/postgresql/PostgreSQLParser.g4 Outdated Show resolved Hide resolved
@tisonkun
Copy link
Contributor Author

tisonkun commented Jul 18, 2023

Please add a test that covers suggested changes.

@KvanTTT The current maven tests seems only test if the query parsed, not the result it parsed out. Shall I build the whole test kit from scratch to verify the op precedence result, or there are some existing tools/cases to leverage?

Co-authored-by: Ivan Kochurkin <kvanttt@gmail.com>
@KvanTTT KvanTTT merged commit 4cfe10d into antlr:master Jul 19, 2023
38 of 39 checks passed
@tisonkun tisonkun deleted the handle-set-op-prec branch July 19, 2023 10:36
rvrooman-codelogic pushed a commit to CodeLogicIncEngineering/grammars-v4-public-fork that referenced this pull request Jul 27, 2023
Now the origin select_cause is redundant since simple_select matches select_with_parens
: simple_select_pramary (INTERSECT all_or_distinct simple_select_pramary)*
;

simple_select_pramary
Copy link
Contributor

Choose a reason for hiding this comment

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

simple_select_"pramary" ? Do you mean "primary" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be a typo 🤣

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.

4 participants