* postgresEndForeignScan * Finish scanning foreign table and dispose objects used for this scan */
| 1709 | * Finish scanning foreign table and dispose objects used for this scan |
| 1710 | */ |
| 1711 | static void |
| 1712 | postgresEndForeignScan(ForeignScanState *node) |
| 1713 | { |
| 1714 | PgFdwScanState *fsstate = (PgFdwScanState *) node->fdw_state; |
| 1715 | |
| 1716 | /* if fsstate is NULL, we are in EXPLAIN; nothing to do */ |
| 1717 | if (fsstate == NULL) |
| 1718 | return; |
| 1719 | |
| 1720 | /* Close the cursor if open, to prevent accumulation of cursors */ |
| 1721 | if (fsstate->cursor_exists) |
| 1722 | close_cursor(fsstate->conn, fsstate->cursor_number, |
| 1723 | fsstate->conn_state); |
| 1724 | |
| 1725 | /* Release remote connection */ |
| 1726 | ReleaseConnection(fsstate->conn); |
| 1727 | fsstate->conn = NULL; |
| 1728 | |
| 1729 | /* MemoryContexts will be deleted automatically. */ |
| 1730 | } |
| 1731 | |
| 1732 | /* |
| 1733 | * postgresAddForeignUpdateTargets |
nothing calls this directly
no test coverage detected