Hello
I trying to implement GROUPING SETS feature. But there is basic
difference between PostgreSQL and ANSI. Pg allows expressions, ANSI
only column reference. I have syntax:
group_clause:
GROUP_P BY grouping_element_list
| /*EMPTY*/
;
grouping_element_list:
grouping_element
{
$$ = list_make1($1);
}
| grouping_element_list ',' grouping_element
{
$$ = lappend($1, $3);
}
;
grouping_element:
ordinary_grouping_set
{
}
| ROLLUP '(' ordinary_grouping_set_list ')'
{
}
| CUBE '(' ordinary_grouping_set_list ')'
{
}
| GROUPING SETS '(' grouping_element_list ')'
{
}
| '(' ')'
{
}
;
ordinary_grouping_set:
grouping_column_ref
{
}
| '(' grouping_ref_list ')'
{
}
;
grouping_ref_list:
grouping_column_ref
{
}
| grouping_ref_list ',' grouping_column_ref
{
}
;
ordinary_grouping_set_list:
ordinary_grouping_set
{
}
| ordinary_grouping_set_list ',' ordinary_grouping_set
{
}
;
grouping_column_ref:
columnref
{}
| Iconst
{}
;
;
this works well, but it is ANSI compliant not pg compliant
after change:
grouping_column_ref:
a_expr
{}
;
I getting
[pavel@localhost parser]$ bison gram.y
gram.y: conflicts: 1 shift/reduce, 1 reduce/reduce
so I cannot find any way to remove shift/reduce.
any ideas?