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.
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 fora_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.