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

Function postgresEndForeignScan

contrib/postgres_fdw/postgres_fdw.c:1711–1730  ·  view source on GitHub ↗

* postgresEndForeignScan * Finish scanning foreign table and dispose objects used for this scan */

Source from the content-addressed store, hash-verified

1709 * Finish scanning foreign table and dispose objects used for this scan
1710 */
1711static void
1712postgresEndForeignScan(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

Callers

nothing calls this directly

Calls 2

ReleaseConnectionFunction · 0.85
close_cursorFunction · 0.70

Tested by

no test coverage detected