1UNLISTEN(7)              PostgreSQL 14.3 Documentation             UNLISTEN(7)
2
3
4

NAME

6       UNLISTEN - stop listening for a notification
7

SYNOPSIS

9       UNLISTEN { channel | * }
10

DESCRIPTION

12       UNLISTEN is used to remove an existing registration for NOTIFY events.
13       UNLISTEN cancels any existing registration of the current PostgreSQL
14       session as a listener on the notification channel named channel. The
15       special wildcard * cancels all listener registrations for the current
16       session.
17
18       NOTIFY(7) contains a more extensive discussion of the use of LISTEN and
19       NOTIFY.
20

PARAMETERS

22       channel
23           Name of a notification channel (any identifier).
24
25       *
26           All current listen registrations for this session are cleared.
27

NOTES

29       You can unlisten something you were not listening for; no warning or
30       error will appear.
31
32       At the end of each session, UNLISTEN * is automatically executed.
33
34       A transaction that has executed UNLISTEN cannot be prepared for
35       two-phase commit.
36

EXAMPLES

38       To make a registration:
39
40           LISTEN virtual;
41           NOTIFY virtual;
42           Asynchronous notification "virtual" received from server process with PID 8448.
43
44       Once UNLISTEN has been executed, further NOTIFY messages will be
45       ignored:
46
47           UNLISTEN virtual;
48           NOTIFY virtual;
49           -- no NOTIFY event is received
50

COMPATIBILITY

52       There is no UNLISTEN command in the SQL standard.
53

SEE ALSO

55       LISTEN(7), NOTIFY(7)
56
57
58
59PostgreSQL 14.3                      2022                          UNLISTEN(7)
Impressum