]> granicus.if.org Git - postgresql/commit
While doing the final setrefs.c pass over a plan tree, try to match up
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Nov 2009 18:04:47 +0000 (18:04 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 16 Nov 2009 18:04:47 +0000 (18:04 +0000)
commit1ec65488c08e7b8681b37e42eb056ea3e8cef382
tree4863c1b824a6e11811d56287108e86baccea3be9
parent4272c8724fb065b54e34007de5bd82996c0be692
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.
src/backend/optimizer/plan/setrefs.c