---------------------------------------------------------------- * ExecEndModifyTable * * Shuts down the plan. * * Returns nothing of interest. * ---------------------------------------------------------------- */
| 3691 | * ---------------------------------------------------------------- |
| 3692 | */ |
| 3693 | void |
| 3694 | ExecEndModifyTable(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 |
no test coverage detected