* Close any relations that have been opened for ResultRelInfos. */
| 2637 | * Close any relations that have been opened for ResultRelInfos. |
| 2638 | */ |
| 2639 | void |
| 2640 | ExecCloseResultRelations(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(). |
no test coverage detected