]> granicus.if.org Git - postgresql/commit
Fix bug with whole-row references to append subplans.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 11 Jul 2014 23:12:51 +0000 (19:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 11 Jul 2014 23:12:51 +0000 (19:12 -0400)
commitcd8ba91a055e7ac8471addf28fa4412db8d2e529
tree79023a7f33dad908936903ffe75d7ec28c2e6326
parent2865d5952d6d89c1006701cb94bc40b146ead880
Fix bug with whole-row references to append subplans.

ExecEvalWholeRowVar incorrectly supposed that it could "bless" the source
TupleTableSlot just once per query.  But if the input is coming from an
Append (or, perhaps, other cases?) more than one slot might be returned
over the query run.  This led to "record type has not been registered"
errors when a composite datum was extracted from a non-blessed slot.

This bug has been there a long time; I guess it escaped notice because when
dealing with subqueries the planner tends to expand whole-row Vars into
RowExprs, which don't have the same problem.  It is possible to trigger
the problem in all active branches, though, as illustrated by the added
regression test.
src/backend/executor/execQual.c
src/test/regress/expected/subselect.out
src/test/regress/sql/subselect.sql