grammars-v4
grammars-v4 copied to clipboard
PostgreSQL parser rule mistake on cube clause
I find the rule not working on sql with cube clauses, for example
Input
GROUP BY a,
CUBE(b,c)
Output
group_clause(group_by_list[group_by_item(a_expr("a"),group_by_item(a_expr("CUBE(b,c)")))])
The problem is the cube clause is parsed as an expression.
I find the problem is likely to be caused by that a_expr has higher priority than cube_clause:
group_by_item
: a_expr
| empty_grouping_set
| cube_clause
| rollup_clause
| grouping_sets_clause
;
So I moved a_expr to the bottom in my own code and it seems to work.
As a new user I'm not quite sure of the effects, so I just report this.