diff options
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); |