DBLINK_OPEN(3)
π DBLINK_OPEN(3) β remote cursor glow-up π
okay so this is the DBLINK_OPEN(3) page from the PostgreSQL 15.19 Documentation, and itβs literally about opening a cursor in a remote database. bestie. cursor. remote. iconic. π¦
πΈ NAME πΈ
dblink_open β opens a cursor in a remote database.
β¨ SYNOPSIS β¨
dblink_open(text cursorname, text sql [, bool fail_on_error]) returns text
dblink_open(text connname, text cursorname, text sql [, bool fail_on_error]) returns text
π DESCRIPTION π
dblink_open() opens a cursor in a remote database. The cursor can subsequently be manipulated with dblink_fetch() and dblink_close(). Thatβs the whole vibe: open it, fetch from it, close it. π«Ά
π ARGUMENTS π
π connname π
Name of the connection to use; omit this parameter to use the unnamed connection.
π cursorname π
The name to assign to this cursor.
π sql π
The SELECT statement that you wish to execute in the remote database, for example select * from pg_class.
π fail_on_error π
If true (the default when omitted) then an error thrown on the remote side of the connection causes an error to also be thrown locally. If false, the remote error is locally reported as a NOTICE, and the functionβs return value is set to ERROR.
π₯ RETURN VALUE π₯
Returns status, either OK or ERROR.
π NOTES π
Since a cursor can only persist within a transaction, dblink_open starts an explicit transaction block (BEGIN) on the remote side, if the remote side was not already within a transaction. This transaction will be closed again when the matching dblink_close is executed.
π warning, bestie: note that if you usedblink_execto change data betweendblink_openanddblink_close, and then an error occurs or you usedblink_disconnectbeforedblink_close, your change will be lost because the transaction will be aborted. no cap, thatβs a whole βyour data said byeβ moment. π
π EXAMPLES π
SELECT dblink_connect('dbname=postgres options=-csearch_path=');
dblink_connect
----------------
OK
(1 row)
SELECT dblink_open('foo', 'select proname, prosrc from pg_proc');
dblink_open
-------------
OK
(1 row)
β¨ and thatβs the tea, bestie β this DBLINK_OPEN(3) page comes from PostgreSQL 15.19, dated 2026. slay. π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15-docs 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms