Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup
Date
Msg-id 2431.1508166918@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom> Uh ... but I thought the point here is that the outputs aren't
>  Tom> really constant in the presence of grouping sets.

> select x, y, sum(z) from (select 1 as x, 2 as y, 3 as z) s
>  group by grouping sets (x,y);

> x and y aren't constants, but z is.

OK, but that just means we should put PHV wrapping around only the
grouping-set columns.

BTW, also need to think about GS expressions, eg

select x+y, sum(z) from (select 1 as x, 2 as y, 3 as z) sgroup by grouping sets (x+y);

Not real sure what needs to happen here.
        regards, tom lane


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

pgsql-bugs by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: [BUGS] Improper const-evaluation of HAVING with grouping sets and subquery pullup
Next
From: Eduardo Pérez Ureta
Date:
Subject: Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type