2008/9/16 Tom Lane <[EMAIL PROTECTED]>:
> "Pavel Stehule" <[EMAIL PROTECTED]> writes:
>> select a, b from t group by grouping sets(a, b);
>
>> is same as:
>
>> select a, NULL from t group by a
>> union all
>> select NULL, b from t group by b;
>
> Really?  That seems utterly bizarre, not to say pointless.
> You sure you read the spec correctly?

If GSi is an <ordinary grouping set>, then
A) Transform SL2 to obtain SL3, and transform HC to obtain HC3, as follows:
    For every PCk, if there is no j such that PCk = GCRi,j, then make
the following
    replacements in SL2 and HC:
    I)      Replace each <grouping operation> in SL2 and HC that
contains a <column ref-
            erence> that references PCk by the <literal> 1 (one).
    II)     Replace each <column reference> in SL2 and HC that references PCk by
            CAST ( NULL AS DTPCk )

if I understend it well, there is little bit different rules than
usual GROUP BY clause.

Is there different way, how to merge more different results? NULL
value is only one possible solution.

Pavel

>
>                        regards, tom lane
>

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to