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

From tgl@postgresql.org (Tom Lane)
Subject pgsql: While doing the final setrefs.c pass over a plan tree, try to
Date
Msg-id 20091116180447.A1E1F753FB7@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
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)

pgsql-committers by date:

Previous
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: While doing the final setrefs.c pass over a plan tree, try to
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Provide a parenthesized-options syntax for VACUUM, analogous to