Re: searching bison guru - grouping sets implementation - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: searching bison guru - grouping sets implementation
Date
Msg-id 48984BA6.4060807@enterprisedb.com
Whole thread Raw
In response to searching bison guru - grouping sets implementation  ("Pavel Stehule" <pavel.stehule@gmail.com>)
Responses Re: searching bison guru - grouping sets implementation  (Gregory Stark <stark@enterprisedb.com>)
Re: searching bison guru - grouping sets implementation  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
Pavel Stehule wrote:
> I trying to implement GROUPING SETS feature. But there is basic
> difference between PostgreSQL and ANSI. Pg allows expressions, ANSI
> only column reference. 

The conflict seems to arise from the parenthesis, between these two rules:

ordinary_grouping_set:        grouping_column_ref            {            }
***            | '(' grouping_ref_list ')'        {            };

and

grouping_column_ref:        a_expr            {}    ;

where a_expr can be something like "(foobar)" as well, enclosed in 
parenthesis. The grammar is ambiguous for something like
"SELECT ... GROUP BY (foobar)", bison doesn't know if that should be 
interpreted as an "'(' grouping_ref_list ')'", whatever that is, or an 
a_expr.

I don't know how that should be resolved, or if it's a genuine ambiguity 
in the ANSI and PostgreSQL syntax or something that can be fixed with 
some Bison magic.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: searching bison guru - grouping sets implementation
Next
From: Dimitri Fontaine
Date:
Subject: Re: Automatic Client Failover