File tree 6 files changed +27
-18
lines changed
6 files changed +27
-18
lines changed Original file line number Diff line number Diff line change @@ -2053,6 +2053,7 @@ void
2053
2053
ExecReScanAgg (AggState * node )
2054
2054
{
2055
2055
ExprContext * econtext = node -> ss .ps .ps_ExprContext ;
2056
+ PlanState * outerPlan = outerPlanState (node );
2056
2057
int aggno ;
2057
2058
2058
2059
node -> agg_done = false;
@@ -2075,7 +2076,7 @@ ExecReScanAgg(AggState *node)
2075
2076
* parameter changes, then we can just rescan the existing hash table;
2076
2077
* no need to build it again.
2077
2078
*/
2078
- if (node -> ss . ps . lefttree -> chgParam == NULL )
2079
+ if (outerPlan -> chgParam == NULL )
2079
2080
{
2080
2081
ResetTupleHashIterator (node -> hashtable , & node -> hashiter );
2081
2082
return ;
@@ -2133,8 +2134,8 @@ ExecReScanAgg(AggState *node)
2133
2134
* if chgParam of subnode is not null then plan will be re-scanned by
2134
2135
* first ExecProcNode.
2135
2136
*/
2136
- if (node -> ss . ps . lefttree -> chgParam == NULL )
2137
- ExecReScan (node -> ss . ps . lefttree );
2137
+ if (outerPlan -> chgParam == NULL )
2138
+ ExecReScan (outerPlan );
2138
2139
}
2139
2140
2140
2141
Original file line number Diff line number Diff line change @@ -449,6 +449,8 @@ ExecBitmapHeapScan(BitmapHeapScanState *node)
449
449
void
450
450
ExecReScanBitmapHeapScan (BitmapHeapScanState * node )
451
451
{
452
+ PlanState * outerPlan = outerPlanState (node );
453
+
452
454
/* rescan to release any page pin */
453
455
heap_rescan (node -> ss .ss_currentScanDesc , NULL );
454
456
@@ -469,8 +471,8 @@ ExecReScanBitmapHeapScan(BitmapHeapScanState *node)
469
471
* if chgParam of subnode is not null then plan will be re-scanned by
470
472
* first ExecProcNode.
471
473
*/
472
- if (node -> ss . ps . lefttree -> chgParam == NULL )
473
- ExecReScan (node -> ss . ps . lefttree );
474
+ if (outerPlan -> chgParam == NULL )
475
+ ExecReScan (outerPlan );
474
476
}
475
477
476
478
/* ----------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -280,6 +280,8 @@ ExecEndGroup(GroupState *node)
280
280
void
281
281
ExecReScanGroup (GroupState * node )
282
282
{
283
+ PlanState * outerPlan = outerPlanState (node );
284
+
283
285
node -> grp_done = FALSE;
284
286
node -> ss .ps .ps_TupFromTlist = false;
285
287
/* must clear first tuple */
@@ -289,7 +291,6 @@ ExecReScanGroup(GroupState *node)
289
291
* if chgParam of subnode is not null then plan will be re-scanned by
290
292
* first ExecProcNode.
291
293
*/
292
- if (node -> ss .ps .lefttree &&
293
- node -> ss .ps .lefttree -> chgParam == NULL )
294
- ExecReScan (node -> ss .ps .lefttree );
294
+ if (outerPlan -> chgParam == NULL )
295
+ ExecReScan (outerPlan );
295
296
}
Original file line number Diff line number Diff line change @@ -317,6 +317,8 @@ ExecMaterialRestrPos(MaterialState *node)
317
317
void
318
318
ExecReScanMaterial (MaterialState * node )
319
319
{
320
+ PlanState * outerPlan = outerPlanState (node );
321
+
320
322
ExecClearTuple (node -> ss .ps .ps_ResultTupleSlot );
321
323
322
324
if (node -> eflags != 0 )
@@ -339,13 +341,13 @@ ExecReScanMaterial(MaterialState *node)
339
341
* Otherwise we can just rewind and rescan the stored output. The
340
342
* state of the subnode does not change.
341
343
*/
342
- if (node -> ss . ps . lefttree -> chgParam != NULL ||
344
+ if (outerPlan -> chgParam != NULL ||
343
345
(node -> eflags & EXEC_FLAG_REWIND ) == 0 )
344
346
{
345
347
tuplestore_end (node -> tuplestorestate );
346
348
node -> tuplestorestate = NULL ;
347
- if (node -> ss . ps . lefttree -> chgParam == NULL )
348
- ExecReScan (node -> ss . ps . lefttree );
349
+ if (outerPlan -> chgParam == NULL )
350
+ ExecReScan (outerPlan );
349
351
node -> eof_underlying = false;
350
352
}
351
353
else
@@ -359,8 +361,8 @@ ExecReScanMaterial(MaterialState *node)
359
361
* if chgParam of subnode is not null then plan will be re-scanned by
360
362
* first ExecProcNode.
361
363
*/
362
- if (node -> ss . ps . lefttree -> chgParam == NULL )
363
- ExecReScan (node -> ss . ps . lefttree );
364
+ if (outerPlan -> chgParam == NULL )
365
+ ExecReScan (outerPlan );
364
366
node -> eof_underlying = false;
365
367
}
366
368
}
Original file line number Diff line number Diff line change @@ -290,6 +290,8 @@ ExecSortRestrPos(SortState *node)
290
290
void
291
291
ExecReScanSort (SortState * node )
292
292
{
293
+ PlanState * outerPlan = outerPlanState (node );
294
+
293
295
/*
294
296
* If we haven't sorted yet, just return. If outerplan's chgParam is not
295
297
* NULL then it will be re-scanned by ExecProcNode, else no reason to
@@ -308,7 +310,7 @@ ExecReScanSort(SortState *node)
308
310
*
309
311
* Otherwise we can just rewind and rescan the sorted output.
310
312
*/
311
- if (node -> ss . ps . lefttree -> chgParam != NULL ||
313
+ if (outerPlan -> chgParam != NULL ||
312
314
node -> bounded != node -> bounded_Done ||
313
315
node -> bound != node -> bound_Done ||
314
316
!node -> randomAccess )
@@ -321,8 +323,8 @@ ExecReScanSort(SortState *node)
321
323
* if chgParam of subnode is not null then plan will be re-scanned by
322
324
* first ExecProcNode.
323
325
*/
324
- if (node -> ss . ps . lefttree -> chgParam == NULL )
325
- ExecReScan (node -> ss . ps . lefttree );
326
+ if (outerPlan -> chgParam == NULL )
327
+ ExecReScan (outerPlan );
326
328
}
327
329
else
328
330
tuplesort_rescan ((Tuplesortstate * ) node -> tuplesortstate );
Original file line number Diff line number Diff line change @@ -2057,6 +2057,7 @@ ExecEndWindowAgg(WindowAggState *node)
2057
2057
void
2058
2058
ExecReScanWindowAgg (WindowAggState * node )
2059
2059
{
2060
+ PlanState * outerPlan = outerPlanState (node );
2060
2061
ExprContext * econtext = node -> ss .ps .ps_ExprContext ;
2061
2062
2062
2063
node -> all_done = false;
@@ -2082,8 +2083,8 @@ ExecReScanWindowAgg(WindowAggState *node)
2082
2083
* if chgParam of subnode is not null then plan will be re-scanned by
2083
2084
* first ExecProcNode.
2084
2085
*/
2085
- if (node -> ss . ps . lefttree -> chgParam == NULL )
2086
- ExecReScan (node -> ss . ps . lefttree );
2086
+ if (outerPlan -> chgParam == NULL )
2087
+ ExecReScan (outerPlan );
2087
2088
}
2088
2089
2089
2090
/*
You can’t perform that action at this time.
0 commit comments