---------------------------------------------------------------- * ExecEndPlan * * Cleans up the query plan -- closes files and frees up storage * * NOTE: we are no longer very worried about freeing storage per se * in this code; FreeExecutorState should be guaranteed to release all * memory that needs to be released. What we are worried about doing * is closing relations and dropping b
| 2595 | * ---------------------------------------------------------------- |
| 2596 | */ |
| 2597 | void |
| 2598 | ExecEndPlan(PlanState *planstate, EState *estate) |
| 2599 | { |
| 2600 | ListCell *l; |
| 2601 | |
| 2602 | /* |
| 2603 | * shut down the node-type-specific query processing |
| 2604 | */ |
| 2605 | ExecEndNode(planstate); |
| 2606 | |
| 2607 | /* |
| 2608 | * for subplans too |
| 2609 | */ |
| 2610 | foreach(l, estate->es_subplanstates) |
| 2611 | { |
| 2612 | PlanState *subplanstate = (PlanState *) lfirst(l); |
| 2613 | |
| 2614 | ExecEndNode(subplanstate); |
| 2615 | } |
| 2616 | |
| 2617 | /* |
| 2618 | * destroy the executor's tuple table. Actually we only care about |
| 2619 | * releasing buffer pins and tupdesc refcounts; there's no need to pfree |
| 2620 | * the TupleTableSlots, since the containing memory context is about to go |
| 2621 | * away anyway. |
| 2622 | */ |
| 2623 | ExecResetTupleTable(estate->es_tupleTable, false); |
| 2624 | |
| 2625 | /* Adjust INSERT/UPDATE/DELETE count for replicated table ON QD */ |
| 2626 | AdjustReplicatedTableCounts(estate); |
| 2627 | |
| 2628 | /* |
| 2629 | * Close any Relations that have been opened for range table entries or |
| 2630 | * result relations. |
| 2631 | */ |
| 2632 | ExecCloseResultRelations(estate); |
| 2633 | ExecCloseRangeTableRelations(estate); |
| 2634 | } |
| 2635 | |
| 2636 | /* |
| 2637 | * Close any relations that have been opened for ResultRelInfos. |
no test coverage detected