File tree Expand file tree Collapse file tree 6 files changed +27
-18
lines changed Expand file tree Collapse file tree 6 files changed +27
-18
lines changed Original file line number Diff line number Diff line change @@ -2053,6 +2053,7 @@ void
20532053ExecReScanAgg (AggState * node )
20542054{
20552055 ExprContext * econtext = node -> ss .ps .ps_ExprContext ;
2056+ PlanState * outerPlan = outerPlanState (node );
20562057 int aggno ;
20572058
20582059 node -> agg_done = false;
@@ -2075,7 +2076,7 @@ ExecReScanAgg(AggState *node)
20752076 * parameter changes, then we can just rescan the existing hash table;
20762077 * no need to build it again.
20772078 */
2078- if (node -> ss . ps . lefttree -> chgParam == NULL )
2079+ if (outerPlan -> chgParam == NULL )
20792080 {
20802081 ResetTupleHashIterator (node -> hashtable , & node -> hashiter );
20812082 return ;
@@ -2133,8 +2134,8 @@ ExecReScanAgg(AggState *node)
21332134 * if chgParam of subnode is not null then plan will be re-scanned by
21342135 * first ExecProcNode.
21352136 */
2136- if (node -> ss . ps . lefttree -> chgParam == NULL )
2137- ExecReScan (node -> ss . ps . lefttree );
2137+ if (outerPlan -> chgParam == NULL )
2138+ ExecReScan (outerPlan );
21382139}
21392140
21402141
Original file line number Diff line number Diff line change @@ -449,6 +449,8 @@ ExecBitmapHeapScan(BitmapHeapScanState *node)
449449void
450450ExecReScanBitmapHeapScan (BitmapHeapScanState * node )
451451{
452+ PlanState * outerPlan = outerPlanState (node );
453+
452454 /* rescan to release any page pin */
453455 heap_rescan (node -> ss .ss_currentScanDesc , NULL );
454456
@@ -469,8 +471,8 @@ ExecReScanBitmapHeapScan(BitmapHeapScanState *node)
469471 * if chgParam of subnode is not null then plan will be re-scanned by
470472 * first ExecProcNode.
471473 */
472- if (node -> ss . ps . lefttree -> chgParam == NULL )
473- ExecReScan (node -> ss . ps . lefttree );
474+ if (outerPlan -> chgParam == NULL )
475+ ExecReScan (outerPlan );
474476}
475477
476478/* ----------------------------------------------------------------
Original file line number Diff line number Diff line change @@ -280,6 +280,8 @@ ExecEndGroup(GroupState *node)
280280void
281281ExecReScanGroup (GroupState * node )
282282{
283+ PlanState * outerPlan = outerPlanState (node );
284+
283285 node -> grp_done = FALSE;
284286 node -> ss .ps .ps_TupFromTlist = false;
285287 /* must clear first tuple */
@@ -289,7 +291,6 @@ ExecReScanGroup(GroupState *node)
289291 * if chgParam of subnode is not null then plan will be re-scanned by
290292 * first ExecProcNode.
291293 */
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 );
295296}
Original file line number Diff line number Diff line change @@ -317,6 +317,8 @@ ExecMaterialRestrPos(MaterialState *node)
317317void
318318ExecReScanMaterial (MaterialState * node )
319319{
320+ PlanState * outerPlan = outerPlanState (node );
321+
320322 ExecClearTuple (node -> ss .ps .ps_ResultTupleSlot );
321323
322324 if (node -> eflags != 0 )
@@ -339,13 +341,13 @@ ExecReScanMaterial(MaterialState *node)
339341 * Otherwise we can just rewind and rescan the stored output. The
340342 * state of the subnode does not change.
341343 */
342- if (node -> ss . ps . lefttree -> chgParam != NULL ||
344+ if (outerPlan -> chgParam != NULL ||
343345 (node -> eflags & EXEC_FLAG_REWIND ) == 0 )
344346 {
345347 tuplestore_end (node -> tuplestorestate );
346348 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 );
349351 node -> eof_underlying = false;
350352 }
351353 else
@@ -359,8 +361,8 @@ ExecReScanMaterial(MaterialState *node)
359361 * if chgParam of subnode is not null then plan will be re-scanned by
360362 * first ExecProcNode.
361363 */
362- if (node -> ss . ps . lefttree -> chgParam == NULL )
363- ExecReScan (node -> ss . ps . lefttree );
364+ if (outerPlan -> chgParam == NULL )
365+ ExecReScan (outerPlan );
364366 node -> eof_underlying = false;
365367 }
366368}
Original file line number Diff line number Diff line change @@ -290,6 +290,8 @@ ExecSortRestrPos(SortState *node)
290290void
291291ExecReScanSort (SortState * node )
292292{
293+ PlanState * outerPlan = outerPlanState (node );
294+
293295 /*
294296 * If we haven't sorted yet, just return. If outerplan's chgParam is not
295297 * NULL then it will be re-scanned by ExecProcNode, else no reason to
@@ -308,7 +310,7 @@ ExecReScanSort(SortState *node)
308310 *
309311 * Otherwise we can just rewind and rescan the sorted output.
310312 */
311- if (node -> ss . ps . lefttree -> chgParam != NULL ||
313+ if (outerPlan -> chgParam != NULL ||
312314 node -> bounded != node -> bounded_Done ||
313315 node -> bound != node -> bound_Done ||
314316 !node -> randomAccess )
@@ -321,8 +323,8 @@ ExecReScanSort(SortState *node)
321323 * if chgParam of subnode is not null then plan will be re-scanned by
322324 * first ExecProcNode.
323325 */
324- if (node -> ss . ps . lefttree -> chgParam == NULL )
325- ExecReScan (node -> ss . ps . lefttree );
326+ if (outerPlan -> chgParam == NULL )
327+ ExecReScan (outerPlan );
326328 }
327329 else
328330 tuplesort_rescan ((Tuplesortstate * ) node -> tuplesortstate );
Original file line number Diff line number Diff line change @@ -2057,6 +2057,7 @@ ExecEndWindowAgg(WindowAggState *node)
20572057void
20582058ExecReScanWindowAgg (WindowAggState * node )
20592059{
2060+ PlanState * outerPlan = outerPlanState (node );
20602061 ExprContext * econtext = node -> ss .ps .ps_ExprContext ;
20612062
20622063 node -> all_done = false;
@@ -2082,8 +2083,8 @@ ExecReScanWindowAgg(WindowAggState *node)
20822083 * if chgParam of subnode is not null then plan will be re-scanned by
20832084 * first ExecProcNode.
20842085 */
2085- if (node -> ss . ps . lefttree -> chgParam == NULL )
2086- ExecReScan (node -> ss . ps . lefttree );
2086+ if (outerPlan -> chgParam == NULL )
2087+ ExecReScan (outerPlan );
20872088}
20882089
20892090/*
You can’t perform that action at this time.
0 commit comments