UNLISTEN(7)
π UNLISTEN(7) β stop listening, bestie π
okay so this is the PostgreSQL 15.19 Documentation page for UNLISTEN, and it's lowkey the unsubscribe button for notification registrations. no cap, it's giving βclean up your listener registrationβ energy. π«Ά
β¨ NAME β¨
UNLISTEN β stop listening for a notification. literally the βcancel my subscriptionβ of the notification world π
π¦ SYNOPSIS π¦
UNLISTEN { channel | * }
πΈ DESCRIPTION πΈ
UNLISTEN is used to remove an existing registration for NOTIFY events. It cancels any existing registration of the current PostgreSQL session as a listener on the notification channel named channel. The special wildcard * cancels all listener registrations for the current session. π
NOTIFY(7) contains a more extensive discussion of the use of LISTEN and NOTIFY. iykyk, go read that one too π
π PARAMETERS π
channelβ name of a notification channel (any identifier).*β all current listen registrations for this session are cleared. periodt.
π₯ NOTES π₯
- You can unlisten something you were not listening for; no warning or error will appear. not me unsubscribing from a channel I never joined π
- At the end of each session,
UNLISTEN *is automatically executed. the cleanup is automatic, bestie. - A transaction that has executed
UNLISTENcannot be prepared for two-phase commit. highkey important caveat, so remember it.
π EXAMPLES π
To make a registration:
LISTEN virtual;
NOTIFY virtual;
Asynchronous notification "virtual" received from server process with PID 8448.
Once UNLISTEN has been executed, further NOTIFY messages will be ignored:
UNLISTEN virtual;
NOTIFY virtual;
-- no NOTIFY event is received
π COMPATIBILITY π
There is no UNLISTEN command in the SQL standard. so yeah, itβs giving not-in-the-standard energy, bestie π
π SEE ALSO π
mwah π β this iconic little page is from PostgreSQL 15.19, dated 2026, and it's literally called UNLISTEN(7). bye bestie π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 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