aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeNestloop.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2011-11-03 00:50:58 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2011-11-03 00:50:58 -0400
commit7e3bf99baa18524de6ef1492cb3057314da97e68 (patch)
tree3ebe96ce2088e06cf2e2ee471ff5e259926cba46 /src/backend/executor/nodeNestloop.c
parent1a77f8b63d159b88ceb6245fcb5e81a7f9ac9a22 (diff)
downloadpostgresql-7e3bf99baa18524de6ef1492cb3057314da97e68.tar.gz
postgresql-7e3bf99baa18524de6ef1492cb3057314da97e68.zip
Fix handling of PlaceHolderVars in nestloop parameter management.
If we use a PlaceHolderVar from the outer relation in an inner indexscan, we need to reference the PlaceHolderVar as such as the value to be passed in from the outer relation. The previous code effectively tried to reconstruct the PHV from its component expression, which doesn't work since (a) the Vars therein aren't necessarily bubbled up far enough, and (b) it would be the wrong semantics anyway because of the possibility that the PHV is supposed to have gone to null at some point before the current join. Point (a) led to "variable not found in subplan target list" planner errors, but point (b) would have led to silently wrong answers. Per report from Roger Niederland.
Diffstat (limited to 'src/backend/executor/nodeNestloop.c')
-rw-r--r--src/backend/executor/nodeNestloop.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index d6433c7f537..9fe78410ce9 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -148,6 +148,7 @@ ExecNestLoop(NestLoopState *node)
prm = &(econtext->ecxt_param_exec_vals[paramno]);
/* Param value should be an OUTER_VAR var */
+ Assert(IsA(nlp->paramval, Var));
Assert(nlp->paramval->varno == OUTER_VAR);
Assert(nlp->paramval->varattno > 0);
prm->value = slot_getattr(outerTupleSlot,