Fix the handling of sub-SELECTs appearing in the arguments of an outer-level
aggregate function. By definition, such a sub-SELECT cannot reference any
variables of query levels between itself and the aggregate's semantic level
(else the aggregate would've been assigned to that lower level instead).
So the correct, most efficient implementation is to treat the sub-SELECT as
being a sub-select of that outer query level, not the level the aggregate
syntactically appears in. Not doing so also confuses the heck out of our
parameter-passing logic, as illustrated in bug report from Daniel Grace.
Fortunately, we were already copying the whole Aggref expression up to the
outer query level, so all that's needed is to delay SS_process_sublinks
processing of the sub-SELECT until control returns to the outer level.
This has been broken since we introduced spec-compliant treatment of
outer aggregates in 7.4; so patch all the way back.
subselect.c (r22.214.171.124 -> r126.96.36.199)
aggregates.out (r1.10 -> r188.8.131.52)
aggregates.sql (r1.8 -> r184.108.40.206)
pgsql-committers by date
|Next:||From: User Gsmet||Date: 2009-04-25 17:07:58|
|Subject: pgfouine - pgfouine: set the garbage collection timeout to 60 seconds|
|Previous:||From: Tom Lane||Date: 2009-04-25 16:45:25|
|Subject: pgsql: Fix the handling of sub-SELECTs appearing in the arguments of an |