]> begriffs open source - ai-pg/blob - full-docs/man7/UNLISTEN.7
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / man7 / UNLISTEN.7
1 '\" t
2 .\"     Title: UNLISTEN
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "UNLISTEN" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 UNLISTEN \- stop listening for a notification
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 UNLISTEN { \fIchannel\fR | * }
36 .fi
37 .SH "DESCRIPTION"
38 .PP
39 \fBUNLISTEN\fR
40 is used to remove an existing registration for
41 \fBNOTIFY\fR
42 events\&.
43 \fBUNLISTEN\fR
44 cancels any existing registration of the current
45 PostgreSQL
46 session as a listener on the notification channel named
47 \fIchannel\fR\&. The special wildcard
48 *
49 cancels all listener registrations for the current session\&.
50 .PP
51 \fBNOTIFY\fR(7)
52 contains a more extensive discussion of the use of
53 \fBLISTEN\fR
54 and
55 \fBNOTIFY\fR\&.
56 .SH "PARAMETERS"
57 .PP
58 \fIchannel\fR
59 .RS 4
60 Name of a notification channel (any identifier)\&.
61 .RE
62 .PP
63 *
64 .RS 4
65 All current listen registrations for this session are cleared\&.
66 .RE
67 .SH "NOTES"
68 .PP
69 You can unlisten something you were not listening for; no warning or error will appear\&.
70 .PP
71 At the end of each session,
72 \fBUNLISTEN *\fR
73 is automatically executed\&.
74 .PP
75 A transaction that has executed
76 \fBUNLISTEN\fR
77 cannot be prepared for two\-phase commit\&.
78 .SH "EXAMPLES"
79 .PP
80 To make a registration:
81 .sp
82 .if n \{\
83 .RS 4
84 .\}
85 .nf
86 LISTEN virtual;
87 NOTIFY virtual;
88 Asynchronous notification "virtual" received from server process with PID 8448\&.
89 .fi
90 .if n \{\
91 .RE
92 .\}
93 .PP
94 Once
95 \fBUNLISTEN\fR
96 has been executed, further
97 \fBNOTIFY\fR
98 messages will be ignored:
99 .sp
100 .if n \{\
101 .RS 4
102 .\}
103 .nf
104 UNLISTEN virtual;
105 NOTIFY virtual;
106 \-\- no NOTIFY event is received
107 .fi
108 .if n \{\
109 .RE
110 .\}
111 .SH "COMPATIBILITY"
112 .PP
113 There is no
114 \fBUNLISTEN\fR
115 command in the SQL standard\&.
116 .SH "SEE ALSO"
117 \fBLISTEN\fR(7), \fBNOTIFY\fR(7)