|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.4 2000/01/26 05:56:24 momjian Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.5 2000/04/07 00:30:41 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -109,8 +109,10 @@ TidNext(TidScan *node)
|
109 | 109 | if (estate->es_evTupleNull[node->scan.scanrelid - 1])
|
110 | 110 | return slot; /* return empty slot */
|
111 | 111 |
|
| 112 | + /* probably ought to use ExecStoreTuple here... */ |
112 | 113 | slot->val = estate->es_evTuple[node->scan.scanrelid - 1];
|
113 | 114 | slot->ttc_shouldFree = false;
|
| 115 | + |
114 | 116 | /* Flag for the next call that no more tuples */
|
115 | 117 | estate->es_evTupleNull[node->scan.scanrelid - 1] = true;
|
116 | 118 | return (slot);
|
@@ -255,38 +257,29 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent)
|
255 | 257 | {
|
256 | 258 | EState *estate;
|
257 | 259 | TidScanState *tidstate;
|
258 |
| - Plan *outerPlan; |
259 | 260 | ItemPointer *tidList;
|
260 | 261 |
|
261 | 262 | tidstate = node->tidstate;
|
262 | 263 | estate = node->scan.plan.state;
|
263 | 264 | tidstate->tss_TidPtr = -1;
|
264 | 265 | tidList = tidstate->tss_TidList;
|
265 | 266 |
|
266 |
| - if ((outerPlan = outerPlan((Plan *) node)) != NULL) |
| 267 | + /* If we are being passed an outer tuple, save it for runtime key calc */ |
| 268 | + if (exprCtxt != NULL) |
| 269 | + node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple = |
| 270 | + exprCtxt->ecxt_outertuple; |
| 271 | + |
| 272 | + /* If this is re-scanning of PlanQual ... */ |
| 273 | + if (estate->es_evTuple != NULL && |
| 274 | + estate->es_evTuple[node->scan.scanrelid - 1] != NULL) |
267 | 275 | {
|
268 |
| - /* we are scanning a subplan */ |
269 |
| - outerPlan = outerPlan((Plan *) node); |
270 |
| - ExecReScan(outerPlan, exprCtxt, parent); |
| 276 | + estate->es_evTupleNull[node->scan.scanrelid - 1] = false; |
| 277 | + return; |
271 | 278 | }
|
272 |
| - else |
273 |
| - /* otherwise, we are scanning a relation */ |
274 |
| - { |
275 |
| - /* If this is re-scanning of PlanQual ... */ |
276 |
| - if (estate->es_evTuple != NULL && |
277 |
| - estate->es_evTuple[node->scan.scanrelid - 1] != NULL) |
278 |
| - { |
279 |
| - estate->es_evTupleNull[node->scan.scanrelid - 1] = false; |
280 |
| - return; |
281 |
| - } |
282 | 279 |
|
283 |
| - /* it's possible in subselects */ |
284 |
| - if (exprCtxt == NULL) |
285 |
| - exprCtxt = node->scan.scanstate->cstate.cs_ExprContext; |
286 |
| - |
287 |
| - node->scan.scanstate->cstate.cs_ExprContext->ecxt_outertuple = exprCtxt->ecxt_outertuple; |
288 |
| - tidstate->tss_NumTids = TidListCreate(node->tideval, exprCtxt, tidList); |
289 |
| - } |
| 280 | + tidstate->tss_NumTids = TidListCreate(node->tideval, |
| 281 | + node->scan.scanstate->cstate.cs_ExprContext, |
| 282 | + tidList); |
290 | 283 |
|
291 | 284 | /* ----------------
|
292 | 285 | * perhaps return something meaningful
|
|
0 commit comments