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

[postgresql] Fix for #4306 -- ambiguity in target_el #4307

Merged
merged 2 commits into from
Nov 4, 2024

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Nov 3, 2024

This is a fix for #4306.

Consider input select x || y from collate_test10;. This substring x || y, can be parsed two ways:

  • target_el => a_expr identifier ==> x || y.
  • target_el => a_expr ==> a_expr_qual_op => a_expr_unary_qualop qual_op a_expr_unary_qualop ==> x || y. This is the likely preferred derivation.

The fix is to add a semantic predicate before an alt in the rule a_expr_qual, which specifies the syntax for a unary postfix operator. Only ! and !! should be allowed.

However, PostgreSQL allows new operators to be declared. This will need to be fixed later on.

@kaby76 kaby76 marked this pull request as draft November 3, 2024 17:45
@kaby76
Copy link
Contributor Author

kaby76 commented Nov 3, 2024

PostgreSQL allows one to declare arbitrary operators with various args and precedence. I'm going to punt on this for now, but it should be fixed properly.

@kaby76 kaby76 marked this pull request as ready for review November 3, 2024 20:24
@kaby76 kaby76 changed the title [postgresql] Fix for #4306 [postgresql] Fix for #4306 -- ambiguity in target_el Nov 4, 2024
@teverett
Copy link
Member

teverett commented Nov 4, 2024

@@kaby76 thanks!

@teverett teverett merged commit 688537b into antlr:master Nov 4, 2024
10 checks passed
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.

2 participants