From: | Heikki Linnakangas <hlinnaka(at)iki(dot)fi> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Pg Bugs <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: Improper const-evaluation of HAVING with grouping sets and subquery pullup |
Date: | 2017-10-17 07:44:23 |
Message-ID: | aefc657e-edb2-64d5-6df1-a0828f6e9104@iki.fi |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2017-10-17 09:16:58 | Re: Improper const-evaluation of HAVING with grouping sets and subquery pullup |
Previous Message | Tom Lane | 2017-10-16 18:33:56 | Re: BUG #14853: Parameter type is required even when the query does not need to know the type |