aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/executor/nodeResult.c14
-rw-r--r--src/backend/optimizer/plan/setrefs.c10
2 files changed, 17 insertions, 7 deletions
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 2d20079569f..98e9d219727 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -38,7 +38,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.38 2007/02/15 03:07:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.39 2007/02/16 03:49:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -309,10 +309,12 @@ ExecReScanResult(ResultState *node, ExprContext *exprCtxt)
node->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
/*
- * if chgParam of subnode is not null then plan will be re-scanned by
- * first ExecProcNode.
+ * If chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode. However, if caller is passing us an exprCtxt
+ * then forcibly rescan the subnode now, so that we can pass the
+ * exprCtxt down to the subnode (needed for gated indexscan).
*/
- if (((PlanState *) node)->lefttree &&
- ((PlanState *) node)->lefttree->chgParam == NULL)
- ExecReScan(((PlanState *) node)->lefttree, exprCtxt);
+ if (node->ps.lefttree &&
+ (node->ps.lefttree->chgParam == NULL || exprCtxt != NULL))
+ ExecReScan(node->ps.lefttree, exprCtxt);
}
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index c356d265e84..bec0ddf7c4b 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.128 2007/01/22 01:35:20 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/plan/setrefs.c,v 1.129 2007/02/16 03:49:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -936,6 +936,14 @@ set_inner_join_references(Plan *inner_plan, indexed_tlist *outer_itlist)
outer_itlist);
}
}
+ else if (IsA(inner_plan, Result))
+ {
+ /* Recurse through a gating Result node (similar to Append case) */
+ Result *result = (Result *) inner_plan;
+
+ if (result->plan.lefttree)
+ set_inner_join_references(result->plan.lefttree, outer_itlist);
+ }
else if (IsA(inner_plan, TidScan))
{
TidScan *innerscan = (TidScan *) inner_plan;