* postgresIterateDirectModify * Execute a direct foreign table modification */
| 2751 | * Execute a direct foreign table modification |
| 2752 | */ |
| 2753 | static TupleTableSlot * |
| 2754 | postgresIterateDirectModify(ForeignScanState *node) |
| 2755 | { |
| 2756 | PgFdwDirectModifyState *dmstate = (PgFdwDirectModifyState *) node->fdw_state; |
| 2757 | EState *estate = node->ss.ps.state; |
| 2758 | ResultRelInfo *resultRelInfo = node->resultRelInfo; |
| 2759 | |
| 2760 | /* |
| 2761 | * If this is the first call after Begin, execute the statement. |
| 2762 | */ |
| 2763 | if (dmstate->num_tuples == -1) |
| 2764 | execute_dml_stmt(node); |
| 2765 | |
| 2766 | /* |
| 2767 | * If the local query doesn't specify RETURNING, just clear tuple slot. |
| 2768 | */ |
| 2769 | if (!resultRelInfo->ri_projectReturning) |
| 2770 | { |
| 2771 | TupleTableSlot *slot = node->ss.ss_ScanTupleSlot; |
| 2772 | Instrumentation *instr = node->ss.ps.instrument; |
| 2773 | |
| 2774 | Assert(!dmstate->has_returning); |
| 2775 | |
| 2776 | /* Increment the command es_processed count if necessary. */ |
| 2777 | if (dmstate->set_processed) |
| 2778 | estate->es_processed += dmstate->num_tuples; |
| 2779 | |
| 2780 | /* Increment the tuple count for EXPLAIN ANALYZE if necessary. */ |
| 2781 | if (instr) |
| 2782 | instr->tuplecount += dmstate->num_tuples; |
| 2783 | |
| 2784 | return ExecClearTuple(slot); |
| 2785 | } |
| 2786 | |
| 2787 | /* |
| 2788 | * Get the next RETURNING tuple. |
| 2789 | */ |
| 2790 | return get_returning_data(node); |
| 2791 | } |
| 2792 | |
| 2793 | /* |
| 2794 | * postgresEndDirectModify |
nothing calls this directly
no test coverage detected