Обсуждение: pgsql: While doing the final setrefs.c pass over a plan tree, try to

Поиск
Список
Период
Сортировка

pgsql: While doing the final setrefs.c pass over a plan tree, try to

От
tgl@postgresql.org (Tom Lane)
Дата:
Log Message:
-----------
While doing the final setrefs.c pass over a plan tree, try to match up
non-Var sort/group expressions using ressortgroupref labels instead of
depending entirely on equal()-ity of the upper node's tlist expressions
to the lower node's.  This avoids emitting the wrong outputs in cases
where there are textually identical volatile sort/group expressions,
as for example
    select distinct random(),random() from generate_series(1,10);
Per report from Andrew Gierth.

Backpatch to 8.4.  Arguably this is wrong all the way back, but the only known
case where there's an observable problem is when using hash aggregation to
implement DISTINCT, which is new as of 8.4.  So for the moment I'll refrain
from backpatching further.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/src/backend/optimizer/plan:
        setrefs.c (r1.150 -> r1.150.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/setrefs.c?r1=1.150&r2=1.150.2.1)