summaryrefslogtreecommitdiff
path: root/src/backend/optimizer
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-10-19 15:08:47 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2010-10-19 15:08:47 -0400
commit01b4bb44fe0b0687ec5578a5fa72527080291c28 (patch)
treec4bdb9c2c4addfea8624bbd284fad2fb1f428939 /src/backend/optimizer
parent80a65c05777ef2b05dfe3a276568cad438fb804d (diff)
Fix incorrect generation of whole-row variables in planner.
A couple of places in the planner need to generate whole-row Vars, and were cutting corners by setting vartype = RECORDOID in the Vars, even in cases where there's an identifiable named composite type for the RTE being referenced. While we mostly got away with this, it failed when there was also a parser-generated whole-row reference to the same RTE, because the two Vars weren't equal() due to the difference in vartype. Fix by providing a subroutine the planner can call to generate whole-row Vars the same way the parser does. Per bug #5716 from Andrew Tipton. Back-patch to 9.0 where one of the bogus calls was introduced (the other one is new in HEAD).
Diffstat (limited to 'src/backend/optimizer')
-rw-r--r--src/backend/optimizer/prep/preptlist.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/backend/optimizer/prep/preptlist.c b/src/backend/optimizer/prep/preptlist.c
index abbf42cb625..2ea01a7f08d 100644
--- a/src/backend/optimizer/prep/preptlist.c
+++ b/src/backend/optimizer/prep/preptlist.c
@@ -170,11 +170,9 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
else
{
/* Not a table, so we need the whole row as a junk var */
- var = makeVar(rc->rti,
- InvalidAttrNumber,
- RECORDOID,
- -1,
- 0);
+ var = makeWholeRowVar(rt_fetch(rc->rti, range_table),
+ rc->rti,
+ 0);
snprintf(resname, sizeof(resname), "wholerow%u", rc->rti);
tle = makeTargetEntry((Expr *) var,
list_length(tlist) + 1,