>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
Tom> I'm not sure if it's worth trying to distinguish whether the Param
Tom> is inside any aggregate calls or not. The existing code gets the
Tom> right answer for
Tom> select array(select x+sum(y) from generate_series(1,3) y group by y)
Tom> from generate_series(1,3) x;
Tom> and we'd be losing some efficiency for cases like that if we fix
Tom> it as above. But is it worth the trouble?
The loss of efficiency could be significant, since it's forcing a rescan
of what could be an expensive plan.
--
Andrew (irc:RhodiumToad)