searching bison guru - grouping sets implementation

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Pg Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: searching bison guru - grouping sets implementation
Date: 2008-08-05 12:19:27
Message-ID: 162867790808050519r2999c603y16f5e483e7984735@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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(at)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?

Attachment Content-Type Size
groupingsets.diff text/x-patch 6.3 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2008-08-05 12:46:30 Re: searching bison guru - grouping sets implementation
Previous Message Magnus Hagander 2008-08-05 11:45:01 Re: Location for pgstat.stat