pgsql: Fix the handling of sub-SELECTs appearing in the arguments of an

Поиск
Список
Период
Сортировка
От tgl@postgresql.org (Tom Lane)
Тема pgsql: Fix the handling of sub-SELECTs appearing in the arguments of an
Дата
Msg-id 20090425164456.CE40E7540A1@cvs.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        subselect.c (r1.148 -> r1.149)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/subselect.c?r1=1.148&r2=1.149)
    pgsql/src/test/regress/expected:
        aggregates.out (r1.18 -> r1.19)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/aggregates.out?r1=1.18&r2=1.19)
    pgsql/src/test/regress/sql:
        aggregates.sql (r1.14 -> r1.15)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/aggregates.sql?r1=1.14&r2=1.15)

В списке pgsql-committers по дате отправления:

Предыдущее
От: momjian@postgresql.org (Bruce Momjian)
Дата:
Сообщение: pgsql: Remove HELIOS Software GmbH name and copyright from AIX dynloader
Следующее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Fix the handling of sub-SELECTs appearing in the arguments of an