DBLINK_GET_NOTIFY(3)

πŸ“¦ version 14.24, in opensuse-leap 16.0

okay so bestie, this is a PostgreSQL 14.24 doc page for dblink_get_notify β€” it lives in the DBLINK_GET_NOTIFY(3) section of the manual, and it's literally your cheat code for grabbing async notifications off a connection. buckle up πŸŽ€


✨ 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)

✨ DESCRIPTION ✨

so dblink_get_notify retrieves notifications on either the unnamed connection, or on a named connection if you specify one. no cap, it's that simple πŸ¦‹

but listen β€” to receive notifications via dblink, LISTEN must first be issued, using dblink_exec. like, that's the whole vibe check. for details see LISTEN(7) and NOTIFY(7) πŸ’–


✨ ARGUMENTS ✨

  • connname β€” the name of a named connection to get notifications on. that's the one, queen πŸ‘‘

✨ RETURN VALUE ✨

returns setof (notify_name text, be_pid int, extra text), or an empty set if none. that's it. if there's nothing waiting for you it's giving empty set energy, and that's fine 😭


✨ EXAMPLES ✨

first you gotta LISTEN, bestie:

    SELECT dblink_exec('LISTEN virtual');
     dblink_exec
    -------------
     LISTEN
    (1 row)

then check what's up:

    SELECT * FROM dblink_get_notify();
     notify_name | be_pid | extra
    -------------+--------+-------
    (0 rows)

nothing yet, we love a quiet moment πŸ™ˆ now somebody fires one off:

    NOTIFY virtual;
    NOTIFY

and look at that, it popped up:

    SELECT * FROM dblink_get_notify();
     notify_name | be_pid | extra
    -------------+--------+-------
     virtual     |   1229 |
    (1 row)

iconic. it ate. periodt πŸ”₯


lowkey reminder: no LISTEN first = no notifications. don't skip the setup step or you'll be staring at 0 rows wondering why πŸ’€

alright bestie, that's the whole page β€” brought to you by the PostgreSQL 14.24 documentation crew, dated 2026, filed forever under DBLINK_GET_NOTIFY(3). go forth and catch those notifications πŸ’œβœ¨

πŸ“¦ where this page comes from