MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecPostprocessPlan

Function ExecPostprocessPlan

src/backend/executor/execMain.c:2539–2583  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecPostprocessPlan * * Give plan nodes a final chance to execute before shutdown * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

2537 * ----------------------------------------------------------------
2538 */
2539static void
2540ExecPostprocessPlan(EState *estate)
2541{
2542 ListCell *lc;
2543
2544 /*
2545 * Make sure nodes run forward.
2546 */
2547 estate->es_direction = ForwardScanDirection;
2548
2549 if (Gp_role == GP_ROLE_DISPATCH)
2550 {
2551 /* Fire after triggers. */
2552 foreach(lc, estate->es_auxmodifytables)
2553 {
2554 PlanState *ps = (PlanState *) lfirst(lc);
2555 ModifyTableState *node = castNode(ModifyTableState, ps);
2556
2557 fireASTriggers(node);
2558 }
2559 return;
2560 }
2561 /*
2562 * Run any secondary ModifyTable nodes to completion, in case the main
2563 * query did not fetch all rows from them. (We do this to ensure that
2564 * such nodes have predictable results.)
2565 */
2566 foreach(lc, estate->es_auxmodifytables)
2567 {
2568 PlanState *ps = (PlanState *) lfirst(lc);
2569
2570 for (;;)
2571 {
2572 TupleTableSlot *slot;
2573
2574 /* Reset the per-output-tuple exprcontext each time */
2575 ResetPerTupleExprContext(estate);
2576
2577 slot = ExecProcNode(ps);
2578
2579 if (TupIsNull(slot))
2580 break;
2581 }
2582 }
2583}
2584
2585/* ----------------------------------------------------------------
2586 * ExecEndPlan

Callers 1

standard_ExecutorFinishFunction · 0.85

Calls 3

fireASTriggersFunction · 0.85
ExecProcNodeFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected