Thread: Re: Patch for adding DATACUBE operator

Re: Patch for adding DATACUBE operator

From
Rod Taylor
Date:
Moving to pgsql-hackers@

On Mon, 2003-06-30 at 12:03, sumit wrote:
>     Thanks for letting know. Could you also let me know the exact
> syntax, I mean, we are not sure whether GROUP BY CUBE(...) is followed by
> a HAVING clause. Kindly inform us soon so that we can make the changes and
> send you the updated patch and files.

Sources of the SQL Spec
http://developer.postgresql.org/readtext.php?src/FAQ/FAQ_DEV.html+Developers-FAQ#1.12

The relevent syntax appears to be in section 7.9, and is a part of the
GROUP BY clause, so is potentially followed by a HAVING clause.
        7.9  <group by clause>
        Function
        Specify a grouped table derived by the application of the
<group by        clause> to the result of the previously specified clause.
        Format
        <group by clause> ::=             GROUP BY <grouping specification>
        <grouping specification> ::=               <grouping column reference>             | <rollup list>
|<cube list>             | <grouping sets list>             | <grand total>             | <concatenated grouping> 
        <rollup list> ::=             ROLLUP <left paren> <grouping column reference list>
<right paren>

        <cube list> ::=             CUBE <left paren> <grouping column reference list> <right
paren>

        <grouping sets list> ::=             GROUPING SETS <left paren> <grouping set list> <right
paren>
        <grouping set list> ::=             <grouping set> [ { <comma> <grouping set> }... ]
        <concatenated grouping> ::=             <grouping set> <comma> <grouping set list>
        <grouping set> ::=               <ordinary grouping set>             | <rollup list>             | <cube list>
          | <grand total> 
        <ordinary grouping set> ::=               <grouping column reference>             | <left paren> <grouping
columnreference list> <right 
paren>

        <grand total> ::= <left paren> <right paren>
        <grouping column reference list> ::=             <grouping column reference>             [ { <comma> <grouping
columnreference> }... ] 

--
Rod Taylor <rbt@rbt.ca>

PGP Key: http://www.rbt.ca/rbtpub.asc