This query surprised me. I expected us to do the Aggregate once for all the
aggregate functions in the select target which is what normally happens. If I
simplify the query further it actually does so.
I don't really understand what's going on here. It can't be the volatile
random() because in
Gregory Stark st...@enterprisedb.com writes:
I don't really understand what's going on here.
It's flattening the sub-select, converting
select sum(n),sum(n)
from (select (select count(*) as n from a ) as n
from (select random() as s) as xyzzy) as xyzzy ;
to
select sum((select