DBLINK_CLOSE(3)
β¨ DBLINK_CLOSE β¨
okay bestie, welcome to the PostgreSQL 18.6 docs, section 3, and today's main character is dblink_close β she closes a cursor in a remote database π no cap, that's literally her whole job and she does it flawlessly.
πΈ NAME πΈ
dblink_close β closes a cursor in a remote database π
π¦ SYNOPSIS π¦
dblink_close(text cursorname [, bool fail_on_error]) returns text
dblink_close(text connname, text cursorname [, bool fail_on_error]) returns text
π DESCRIPTION π
So like, dblink_close closes a cursor that you already opened with dblink_open. That's it. That's the vibe. She's the closer. The one who ends things cleanly. iconic behavior honestly β¨
π«Ά ARGUMENTS π«Ά
connnameβ the name of the connection you wanna use. Omit this parameter and you'll be using the unnamed connection instead, which is giving "we're not labeling this, we're just going with it" energy πcursornameβ the name of the cursor you're closing. say goodbye, wave, it's over π¦fail_on_errorβ if it'strue(which is the default when you omit it), then when an error gets thrown on the remote side of the connection, an error also gets thrown locally. If it'sfalse, that remote error is instead reported locally as aNOTICE, and the function's return value gets set toERROR. so like, either it screams at you or it just quietly notes it. your call π
β RETURN VALUE β
She returns a status, and it's either OK or ERROR. two options, no in-between, very decisive of her π
π NOTES π
okay here's the tea, and it's important tea: if dblink_open started an explicit transaction block, and this is the last remaining open cursor on this connection, then dblink_close will issue the matching COMMIT. so she's not just closing a cursor, she's also wrapping up the whole situation when she's the last one standing. main character energy fr fr π
bestie pls note: that COMMIT only happens when BOTH of those things are true β the explicit transaction block was started, AND this is the last open cursor on the connection. don't skip that part π
π EXAMPLES π
look at her go, she ate:
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)
SELECT dblink_close('foo');
dblink_close
--------------
OK
(1 row)
connect, open, close. a whole little arc. she understood the assignment β¨π
π SEE ALSO π
honestly bestie there's no SEE ALSO section in this one β she stands on her own. queen behavior π
and that's the page, bestie π this was DBLINK_CLOSE(3) from the PostgreSQL 18.6 Documentation, dated 2026. go close some cursors, you've got this π«Άβ¨π
π¦ where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-contrib 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-contrib 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms