aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeIndexscan.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-04-07 00:30:41 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-04-07 00:30:41 +0000
commit891039c15f0d0a0a7adba71a7ceb77fa74bb3b9c (patch)
treecf966484d507481eef82678fc1696515b3f97087 /src/backend/executor/nodeIndexscan.c
parenta25a4907186689c27ad26db122b4438265eeae8c (diff)
downloadpostgresql-891039c15f0d0a0a7adba71a7ceb77fa74bb3b9c.tar.gz
postgresql-891039c15f0d0a0a7adba71a7ceb77fa74bb3b9c.zip
Partial fix for EvalPlanQual bugs reported by Magnus Hagander, 3-Apr.
Ensure that outer tuple link needed for inner indexscan qual evaluation gets set in the EvalPlanQual case. This stops coredump, but we still have resource leaks due to failure to clean up EvalPlanQual properly...
Diffstat (limited to 'src/backend/executor/nodeIndexscan.c')
-rw-r--r--src/backend/executor/nodeIndexscan.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index b1d1c578f38..16fcd225a8e 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.47 2000/02/18 09:29:57 inoue Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.48 2000/04/07 00:30:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -338,6 +338,11 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
if (ScanDirectionIsBackward(node->indxorderdir))
indexstate->iss_IndexPtr = numIndices;
+ /* If we are being passed an outer tuple, save it for runtime key calc */
+ if (exprCtxt != NULL)
+ node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple =
+ exprCtxt->ecxt_outertuple;
+
/* If this is re-scanning of PlanQual ... */
if (estate->es_evTuple != NULL &&
estate->es_evTuple[node->scan.scanrelid - 1] != NULL)
@@ -346,12 +351,6 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
return;
}
- /* it's possible in subselects */
- if (exprCtxt == NULL)
- exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
-
- node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
-
/*
* get the index qualifications and recalculate the appropriate values
*/
@@ -379,14 +378,16 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
{
clause = nth(j, qual);
scanexpr = (run_keys[j] == RIGHT_OP) ?
- (Node *) get_rightop(clause) : (Node *) get_leftop(clause);
-
+ (Node *) get_rightop(clause) :
+ (Node *) get_leftop(clause);
/*
* pass in isDone but ignore it. We don't iterate in
* quals
*/
scanvalue = (Datum)
- ExecEvalExpr(scanexpr, exprCtxt, &isNull, &isDone);
+ ExecEvalExpr(scanexpr,
+ node->scan.scanstate->cstate.cs_ExprContext,
+ &isNull, &isDone);
scan_keys[j].sk_argument = scanvalue;
if (isNull)
scan_keys[j].sk_flags |= SK_ISNULL;