> For the complete documentation index, see [llms.txt](https://docs.postgresql.tw/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.postgresql.tw/11/appendixes/additional-supplied-modules/dblink.md).

# F.11. dblink

[dblink\_connect](https://www.postgresql.org/docs/10/static/contrib-dblink-connect.html)

— opens a persistent connection to a remote database

[dblink\_connect\_u](https://www.postgresql.org/docs/10/static/contrib-dblink-connect-u.html)

— opens a persistent connection to a remote database, insecurely

[dblink\_disconnect](https://www.postgresql.org/docs/10/static/contrib-dblink-disconnect.html)

— closes a persistent connection to a remote database

[dblink](https://www.postgresql.org/docs/10/static/contrib-dblink-function.html)

— executes a query in a remote database

[dblink\_exec](https://www.postgresql.org/docs/10/static/contrib-dblink-exec.html)

— executes a command in a remote database

[dblink\_open](https://www.postgresql.org/docs/10/static/contrib-dblink-open.html)

— opens a cursor in a remote database

[dblink\_fetch](https://www.postgresql.org/docs/10/static/contrib-dblink-fetch.html)

— returns rows from an open cursor in a remote database

[dblink\_close](https://www.postgresql.org/docs/10/static/contrib-dblink-close.html)

— closes a cursor in a remote database

[dblink\_get\_connections](https://www.postgresql.org/docs/10/static/contrib-dblink-get-connections.html)

— returns the names of all open named dblink connections

[dblink\_error\_message](https://www.postgresql.org/docs/10/static/contrib-dblink-error-message.html)

— gets last error message on the named connection

[dblink\_send\_query](https://www.postgresql.org/docs/10/static/contrib-dblink-send-query.html)

— sends an async query to a remote database

[dblink\_is\_busy](https://www.postgresql.org/docs/10/static/contrib-dblink-is-busy.html)

— checks if connection is busy with an async query

[dblink\_get\_notify](https://www.postgresql.org/docs/10/static/contrib-dblink-get-notify.html)

— retrieve async notifications on a connection

[dblink\_get\_result](https://www.postgresql.org/docs/10/static/contrib-dblink-get-result.html)

— gets an async query result

[dblink\_cancel\_query](https://www.postgresql.org/docs/10/static/contrib-dblink-cancel-query.html)

— cancels any active query on the named connection

[dblink\_get\_pkey](https://www.postgresql.org/docs/10/static/contrib-dblink-get-pkey.html)

— returns the positions and field names of a relation's primary key fields

[dblink\_build\_sql\_insert](https://www.postgresql.org/docs/10/static/contrib-dblink-build-sql-insert.html)

— builds an INSERT statement using a local tuple, replacing the primary key field values with alternative supplied values

[dblink\_build\_sql\_delete](https://www.postgresql.org/docs/10/static/contrib-dblink-build-sql-delete.html)

— builds a DELETE statement using supplied values for primary key field values

[dblink\_build\_sql\_update](https://www.postgresql.org/docs/10/static/contrib-dblink-build-sql-update.html)

— builds an UPDATE statement using a local tuple, replacing the primary key field values with alternative supplied values

`dblink`is a module that supports connections to otherPostgreSQLdatabases from within a database session.

See also[postgres\_fdw](https://www.postgresql.org/docs/10/static/postgres-fdw.html), which provides roughly the same functionality using a more modern and standards-compliant infrastructure.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.postgresql.tw/11/appendixes/additional-supplied-modules/dblink.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
