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

Function ExecCloseResultRelations

src/backend/executor/execMain.c:2639–2675  ·  view source on GitHub ↗

* Close any relations that have been opened for ResultRelInfos. */

Source from the content-addressed store, hash-verified

2637 * Close any relations that have been opened for ResultRelInfos.
2638 */
2639void
2640ExecCloseResultRelations(EState *estate)
2641{
2642 ListCell *l;
2643
2644 /*
2645 * close indexes of result relation(s) if any. (Rels themselves are
2646 * closed in ExecCloseRangeTableRelations())
2647 */
2648 foreach(l, estate->es_opened_result_relations)
2649 {
2650 ResultRelInfo *resultRelInfo = lfirst(l);
2651
2652 ExecCloseIndices(resultRelInfo);
2653 }
2654
2655 /* Close any relations that have been opened by ExecGetTriggerResultRel(). */
2656 foreach(l, estate->es_trig_target_relations)
2657 {
2658 ResultRelInfo *resultRelInfo = (ResultRelInfo *) lfirst(l);
2659
2660 /*
2661 * Assert this is a "dummy" ResultRelInfo, see above. Otherwise we
2662 * might be issuing a duplicate close against a Relation opened by
2663 * ExecGetRangeTableRelation.
2664 */
2665 Assert(resultRelInfo->ri_RangeTableIndex == 0);
2666
2667 /*
2668 * Since ExecGetTriggerResultRel doesn't call ExecOpenIndices for
2669 * these rels, we needn't call ExecCloseIndices either.
2670 */
2671 Assert(resultRelInfo->ri_NumIndices == 0);
2672
2673 table_close(resultRelInfo->ri_RelationDesc, NoLock);
2674 }
2675}
2676
2677/*
2678 * Close all relations opened by ExecGetRangeTableRelation().

Callers 5

afterTriggerInvokeEventsFunction · 0.85
CopyFromDirectoryTableFunction · 0.85
CopyFromFunction · 0.85
ExecEndPlanFunction · 0.85
EvalPlanQualEndFunction · 0.85

Calls 3

ExecCloseIndicesFunction · 0.85
table_closeFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected