1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/unlisten.sgml
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
1999-07-22 17:09:15 +02:00
|
|
|
-->
|
|
|
|
|
1999-07-14 22:32:59 +02:00
|
|
|
<refentry id="SQL-UNLISTEN">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-unlisten">
|
|
|
|
<primary>UNLISTEN</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
1999-07-14 22:32:59 +02:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>UNLISTEN</refentrytitle>
|
2008-11-14 11:22:48 +01:00
|
|
|
<manvolnum>7</manvolnum>
|
1999-07-14 22:32:59 +02:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
2003-04-27 01:56:51 +02:00
|
|
|
|
1999-07-14 22:32:59 +02:00
|
|
|
<refnamediv>
|
2003-04-27 01:56:51 +02:00
|
|
|
<refname>UNLISTEN</refname>
|
|
|
|
<refpurpose>stop listening for a notification</refpurpose>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refnamediv>
|
2003-04-27 01:56:51 +02:00
|
|
|
|
1999-07-14 22:32:59 +02:00
|
|
|
<refsynopsisdiv>
|
2003-04-27 01:56:51 +02:00
|
|
|
<synopsis>
|
2017-10-09 04:00:57 +02:00
|
|
|
UNLISTEN { <replaceable class="parameter">channel</replaceable> | * }
|
2003-04-27 01:56:51 +02:00
|
|
|
</synopsis>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refsynopsisdiv>
|
|
|
|
|
2003-04-27 01:56:51 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
1999-07-14 22:32:59 +02:00
|
|
|
|
|
|
|
<para>
|
2003-04-27 01:56:51 +02:00
|
|
|
<command>UNLISTEN</command> is used to remove an existing
|
|
|
|
registration for <command>NOTIFY</command> events.
|
|
|
|
<command>UNLISTEN</command> cancels any existing registration of
|
|
|
|
the current <productname>PostgreSQL</productname> session as a
|
2010-02-16 23:34:57 +01:00
|
|
|
listener on the notification channel named <replaceable
|
2017-10-09 04:00:57 +02:00
|
|
|
class="parameter">channel</replaceable>. The special wildcard
|
2003-04-27 01:56:51 +02:00
|
|
|
<literal>*</literal> cancels all listener registrations for the
|
|
|
|
current session.
|
1999-07-14 22:32:59 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2010-04-03 09:23:02 +02:00
|
|
|
<xref linkend="sql-notify">
|
1999-07-14 22:32:59 +02:00
|
|
|
contains a more extensive
|
|
|
|
discussion of the use of <command>LISTEN</command> and
|
|
|
|
<command>NOTIFY</command>.
|
|
|
|
</para>
|
2003-04-27 01:56:51 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><replaceable class="parameter">channel</replaceable></term>
|
2003-04-27 01:56:51 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2010-02-16 23:34:57 +01:00
|
|
|
Name of a notification channel (any identifier).
|
2003-04-27 01:56:51 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><literal>*</literal></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
All current listen registrations for this session are cleared.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
|
|
|
|
<para>
|
Update reference documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:
may - permission, "You may borrow my rake."
can - ability, "I can lift that log."
might - possibility, "It might rain today."
Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice. Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 00:26:05 +01:00
|
|
|
You can unlisten something you were not listening for; no warning or error
|
2003-09-09 20:28:53 +02:00
|
|
|
will appear.
|
2003-04-27 01:56:51 +02:00
|
|
|
</para>
|
1999-07-14 22:32:59 +02:00
|
|
|
|
2003-04-27 01:56:51 +02:00
|
|
|
<para>
|
2003-09-09 20:28:53 +02:00
|
|
|
At the end of each session, <command>UNLISTEN *</command> is
|
2003-04-27 01:56:51 +02:00
|
|
|
automatically executed.
|
|
|
|
</para>
|
2010-02-16 23:34:57 +01:00
|
|
|
|
|
|
|
<para>
|
|
|
|
A transaction that has executed <command>UNLISTEN</command> cannot be
|
|
|
|
prepared for two-phase commit.
|
|
|
|
</para>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refsect1>
|
|
|
|
|
2003-04-27 01:56:51 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Examples</title>
|
1999-07-14 22:32:59 +02:00
|
|
|
|
|
|
|
<para>
|
2003-04-27 01:56:51 +02:00
|
|
|
To make a registration:
|
1999-07-14 22:32:59 +02:00
|
|
|
|
2000-03-26 20:32:30 +02:00
|
|
|
<programlisting>
|
2000-07-21 06:49:23 +02:00
|
|
|
LISTEN virtual;
|
|
|
|
NOTIFY virtual;
|
2003-09-13 01:04:46 +02:00
|
|
|
Asynchronous notification "virtual" received from server process with PID 8448.
|
2000-03-26 20:32:30 +02:00
|
|
|
</programlisting>
|
1999-07-14 22:32:59 +02:00
|
|
|
</para>
|
1998-10-21 07:34:12 +02:00
|
|
|
|
1999-07-14 22:32:59 +02:00
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
Once <command>UNLISTEN</command> has been executed, further <command>NOTIFY</command>
|
2010-02-16 23:34:57 +01:00
|
|
|
messages will be ignored:
|
1999-07-14 22:32:59 +02:00
|
|
|
|
2000-03-26 20:32:30 +02:00
|
|
|
<programlisting>
|
2000-07-21 06:48:33 +02:00
|
|
|
UNLISTEN virtual;
|
|
|
|
NOTIFY virtual;
|
2003-04-27 01:56:51 +02:00
|
|
|
-- no NOTIFY event is received
|
2011-08-07 09:49:45 +02:00
|
|
|
</programlisting></para>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refsect1>
|
|
|
|
|
2003-04-27 01:56:51 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
There is no <command>UNLISTEN</command> command in the SQL standard.
|
|
|
|
</para>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refsect1>
|
2003-09-15 05:21:51 +02:00
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2010-04-03 09:23:02 +02:00
|
|
|
<member><xref linkend="sql-listen"></member>
|
|
|
|
<member><xref linkend="sql-notify"></member>
|
2003-09-15 05:21:51 +02:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
1999-07-14 22:32:59 +02:00
|
|
|
</refentry>
|