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

Function ExecEndModifyTable

src/backend/executor/nodeModifyTable.c:3693–3765  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecEndModifyTable * * Shuts down the plan. * * Returns nothing of interest. * ---------------------------------------------------------------- */

Source from the content-addressed store, hash-verified

3691 * ----------------------------------------------------------------
3692 */
3693void
3694ExecEndModifyTable(ModifyTableState *node)
3695{
3696 int i;
3697
3698 /*
3699 * Allow any FDWs to shut down
3700 */
3701 for (i = 0; i < node->mt_nrels; i++)
3702 {
3703 int j;
3704 ResultRelInfo *resultRelInfo = node->resultRelInfo + i;
3705
3706 if (!resultRelInfo->ri_usesFdwDirectModify &&
3707 resultRelInfo->ri_FdwRoutine != NULL &&
3708 resultRelInfo->ri_FdwRoutine->EndForeignModify != NULL)
3709 resultRelInfo->ri_FdwRoutine->EndForeignModify(node->ps.state,
3710 resultRelInfo);
3711
3712 table_dml_fini(resultRelInfo->ri_RelationDesc, node->operation);
3713
3714 /*
3715 * Cleanup the initialized batch slots. This only matters for FDWs
3716 * with batching, but the other cases will have ri_NumSlotsInitialized
3717 * == 0.
3718 */
3719 for (j = 0; j < resultRelInfo->ri_NumSlotsInitialized; j++)
3720 {
3721 ExecDropSingleTupleTableSlot(resultRelInfo->ri_Slots[j]);
3722 ExecDropSingleTupleTableSlot(resultRelInfo->ri_PlanSlots[j]);
3723 }
3724 }
3725
3726 /*
3727 * Close all the partitioned tables, leaf partitions, and their indices
3728 * and release the slot used for tuple routing, if set.
3729 */
3730 if (node->mt_partition_tuple_routing)
3731 {
3732 ExecCleanupTupleRouting(node, node->mt_partition_tuple_routing);
3733
3734 if (node->mt_root_tuple_slot)
3735 ExecDropSingleTupleTableSlot(node->mt_root_tuple_slot);
3736 }
3737
3738 /*
3739 * Free the exprcontext
3740 */
3741 ExecFreeExprContext(&node->ps);
3742
3743 /*
3744 * clean out the tuple table
3745 */
3746 if (node->ps.ps_ResultTupleSlot)
3747 ExecClearTuple(node->ps.ps_ResultTupleSlot);
3748
3749 /*
3750 * Terminate EPQ execution if active

Callers 1

ExecEndNodeFunction · 0.85

Calls 10

table_dml_finiFunction · 0.85
ExecCleanupTupleRoutingFunction · 0.85
ExecFreeExprContextFunction · 0.85
ExecClearTupleFunction · 0.85
EvalPlanQualEndFunction · 0.85
ExecEndNodeFunction · 0.85
hash_get_num_entriesFunction · 0.85
hash_destroyFunction · 0.85

Tested by

no test coverage detected