Open kaby76 opened 4 days ago
There are several problems here with the rules that implement operator precedence. It was not implemented correctly for a_expr_compare
and a_expr_at_time_zone
.https://github.com/antlr/grammars-v4/blob/97bd28855acf37204623a71eb9d5ce3f9f62f80a/sql/postgresql/PostgreSQLParser.g4#L3669-L3671
For some reason, the person who implemented this seemed to think you can put any nonterminal after the operator. This is not true.
Consider input
select * from tmptz where f1 at time zone 'utc' = '2017-01-18 00:00';
from examples/timestamptz.sql. The parse is ambiguous.The problem is in a_expr_compare: https://github.com/antlr/grammars-v4/blob/97bd28855acf37204623a71eb9d5ce3f9f62f80a/sql/postgresql/PostgreSQLParser.g4#L3618-L3623