Here's another interesting case, without any subqueries:
postgres=# SELECT g as newalias1, g as newalias3
FROM generate_series(1,3) g
GROUP BY newalias1, ROLLUP(newalias3); newalias1 | newalias3
-----------+----------- 1 | 1 3 | 3 2 | 2 2 | 2
3| 3 1 | 1
(6 rows)
Why are there no "summary" rows with NULLs, despite the ROLLUP? If you
replace one of the g's with (g+0), you get the expected result:
postgres=# SELECT g as newalias1, (g+0) as newalias3
FROM generate_series(1,3) g
GROUP BY newalias1, ROLLUP(newalias3); newalias1 | newalias3
-----------+----------- 1 | 1 3 | 3 2 | 2 2 | 3 |
1 |
(6 rows)
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs