diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-02-11 20:10:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-02-11 20:10:50 +0000 |
commit | 6799a6ca21e509f3fd16a057e30970f500273d1a (patch) | |
tree | facbd1e39e713be5f087c9dd9c327a5de9c9ebc4 /src/backend/executor/nodeTidscan.c | |
parent | 0cdf4d96bcd3b82ef712243f783a54da04a95bda (diff) | |
download | postgresql-6799a6ca21e509f3fd16a057e30970f500273d1a.tar.gz postgresql-6799a6ca21e509f3fd16a057e30970f500273d1a.zip |
Repair problems with EvalPlanQual where target table is scanned as
inner indexscan (ie, one with runtime keys). ExecIndexReScan must
compute or recompute runtime keys even if we are rescanning in the
EPQ case. TidScan seems to have comparable problems. Per bug
noted by Barry Lind 11-Feb-02.
Diffstat (limited to 'src/backend/executor/nodeTidscan.c')
-rw-r--r-- | src/backend/executor/nodeTidscan.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c index fb2e3d53d37..08685571cab 100644 --- a/src/backend/executor/nodeTidscan.c +++ b/src/backend/executor/nodeTidscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.21 2001/10/28 06:25:43 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.22 2002/02/11 20:10:50 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -108,6 +108,11 @@ TidNext(TidScan *node) if (estate->es_evTupleNull[node->scan.scanrelid - 1]) return slot; /* return empty slot */ + /* + * XXX shouldn't we check here to make sure tuple matches TID list? + * In runtime-key case this is not certain, is it? + */ + ExecStoreTuple(estate->es_evTuple[node->scan.scanrelid - 1], slot, InvalidBuffer, false); @@ -250,9 +255,8 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent) TidScanState *tidstate; ItemPointerData *tidList; - tidstate = node->tidstate; estate = node->scan.plan.state; - tidstate->tss_TidPtr = -1; + tidstate = node->tidstate; tidList = tidstate->tss_TidList; /* If we are being passed an outer tuple, save it for runtime key calc */ @@ -260,6 +264,13 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent) node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple = exprCtxt->ecxt_outertuple; + /* do runtime calc of target TIDs, if needed */ + if (node->needRescan) + tidstate->tss_NumTids = + TidListCreate(node->tideval, + node->scan.scanstate->cstate.cs_ExprContext, + tidList); + /* If this is re-scanning of PlanQual ... */ if (estate->es_evTuple != NULL && estate->es_evTuple[node->scan.scanrelid - 1] != NULL) @@ -268,9 +279,7 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent) return; } - tidstate->tss_NumTids = TidListCreate(node->tideval, - node->scan.scanstate->cstate.cs_ExprContext, - tidList); + tidstate->tss_TidPtr = -1; /* * perhaps return something meaningful @@ -432,7 +441,9 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent) tidList = (ItemPointerData *) palloc(length(node->tideval) * sizeof(ItemPointerData)); numTids = 0; if (!node->needRescan) - numTids = TidListCreate(node->tideval, scanstate->cstate.cs_ExprContext, tidList); + numTids = TidListCreate(node->tideval, + scanstate->cstate.cs_ExprContext, + tidList); tidPtr = -1; CXT1_printf("ExecInitTidScan: context is %d\n", CurrentMemoryContext); |