DBLINK_GET_NOTIFY(3)
π DBLINK_GET_NOTIFY π
okay bestie so this is a PostgreSQL 15.19 moment and you're about to learn how to scoop up async notifications on a connection β dblink_get_notify, live and in colour β¨
π NAME π
dblink_get_notify β retrieve async notifications on a connection π¦
β¨ SYNOPSIS β¨
dblink_get_notify() returns setof (notify_name text, be_pid int, extra text)
dblink_get_notify(text connname) returns setof (notify_name text, be_pid int, extra text)
literally two vibes: no args, or one arg. pick your fighter π
πΈ DESCRIPTION πΈ
okay so dblink_get_notify retrieves notifications on either the unnamed connection, or on a named connection if you specified one. that's the whole thing, no cap π«Ά
β οΈ but listen β to receive notifications viadblink,LISTENmust first be issued, usingdblink_exec. don't skip this step bestie, it's giving prerequisites π
for the deets, go see LISTEN(7) and NOTIFY(7) β iykyk π
π¦ ARGUMENTS π¦
connnameβ the name of a named connection you wanna get notifications on. that's it. that's the arg π
π RETURN VALUE π
returns setof (notify_name text, be_pid int, extra text), or an empty set if there are none. so like, either you get rows or you get zero rows, no in-between, periodt β
π EXAMPLES π
first things first β you gotta LISTEN, and dblink_exec is the way you do it:
SELECT dblink_exec('LISTEN virtual');
dblink_exec
-------------
LISTEN
(1 row)
then vibe check the notifications (spoiler: nothing's there yet, it's giving empty) π
SELECT * FROM dblink_get_notify();
notify_name | be_pid | extra
-------------+--------+-------
(0 rows)
now let's actually send one:
NOTIFY virtual;
NOTIFY
and boom, look at that, a whole row appeared, ate and left no crumbs π₯
SELECT * FROM dblink_get_notify();
notify_name | be_pid | extra
-------------+--------+-------
virtual | 1229 |
(1 row)
and that's the whole page, bestie!! π§πβ¨
this lil masterpiece is from PostgreSQL 15.19, dated 2026, and it lives in the DBLINK_GET_NOTIFY(3) section of the manual (section 3, the library-calls girlies π). go forth and notify, main character π
πΈ
π¦ 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