Re: proposal - GROUPING SETS
От | Pavel Stehule |
---|---|
Тема | Re: proposal - GROUPING SETS |
Дата | |
Msg-id | 162867790809160722g3d90abe2wf0da18b775f3ae6e@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: proposal - GROUPING SETS (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
2008/9/16 Tom Lane <tgl@sss.pgh.pa.us>: > "Pavel Stehule" <pavel.stehule@gmail.com> 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 >
В списке pgsql-hackers по дате отправления: