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 #4332 -- fix ambiguity with '=' (rewrite Floyd operator precedence grammar) #4334

Closed
wants to merge 1 commit into from

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Nov 19, 2024

This is a fix for #4332.

The problem raised in the issue was the ambiguity with select * from tmptz where f1 at time zone 'utc' = '2017-01-18 00:00';. But, the problem was the haphazard implementation of the operator precedence grammar for a_expr.

I rewrote the rules associated with a_expr to use the Antlr style for expressions, fixing the ambiguity. In addition, the parse trees for expressions are much more concise. I will need to unfold c_expr into a_expr and refactor the order of alts to correspond to the correct precedence--and remove ambiguity that I introduced with the rewrite of a_expr. This is important because Antlr does not implement precedence like Bison. Some of the alts for a_expr were removed because they overlapped with those in c_expr.

Not only are the trees much smaller, but it is also a little faster, taking ~7s for the examples/ test suite vs. ~8s before this PR.

To do: Add expression tests with parse trees.

@kaby76
Copy link
Contributor Author

kaby76 commented Nov 21, 2024

Added a bunch of ambiguity. Will need to clean up before submitting.

@kaby76 kaby76 closed this Nov 21, 2024
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.

1 participant