postgresql/doc/src/sgml/ref/unlisten.sgml

179 lines
3.4 KiB
Plaintext
Raw Normal View History

1998-10-08 02:19:13 +02:00
<REFENTRY ID="SQL-UNLISTEN">
<REFMETA>
<REFENTRYTITLE>
UNLISTEN
</REFENTRYTITLE>
<REFMISCINFO>SQL - Language Statements</REFMISCINFO>
</REFMETA>
<REFNAMEDIV>
<REFNAME>
UNLISTEN
</REFNAME>
<REFPURPOSE>
Stop listening for notification
1998-10-08 02:19:13 +02:00
</REFPURPOSE>
</refnamediv>
1998-10-08 02:19:13 +02:00
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
<DATE>1998-10-19</DATE>
1998-10-08 02:19:13 +02:00
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
UNLISTEN { <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE> | * }
1998-10-08 02:19:13 +02:00
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-UNLISTEN-1">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
1998-10-08 02:19:13 +02:00
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
Name of previously registered notify condition.
</para>
</listitem>
</varlistentry>
<VARLISTENTRY>
<TERM>
<literal>*</literal>
</TERM>
<LISTITEM>
<PARA>
All current listen registrations for this backend are cleared.
</para>
</listitem>
</varlistentry>
1998-10-08 02:19:13 +02:00
</VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-UNLISTEN-2">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
1998-10-08 02:19:13 +02:00
</REFSECT2INFO>
<TITLE>
Outputs
</TITLE>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
<returnvalue>UNLISTEN</returnvalue>
</TERM>
<LISTITEM>
<PARA>
Acknowledgement that statement has executed.
</para>
</listitem>
</varlistentry>
1998-10-08 02:19:13 +02:00
</VARIABLELIST>
</para>
1998-10-08 02:19:13 +02:00
</REFSECT2>
</REFSYNOPSISDIV>
<REFSECT1 ID="R1-SQL-UNLISTEN-1">
<REFSECT1INFO>
<DATE>1998-10-19</DATE>
1998-10-08 02:19:13 +02:00
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
<command>UNLISTEN</command>
is used to remove an existing <command>NOTIFY</command> registration.
1998-10-08 02:19:13 +02:00
UNLISTEN cancels any existing registration of the current
<productname>Postgres</productname> session as a listener on the notify
1998-10-08 02:19:13 +02:00
condition <REPLACEABLE CLASS="PARAMETER">notifyname</REPLACEABLE>.
The special condition wildcard "*" cancels all listener registrations
for the current session.
</para>
1998-10-08 02:19:13 +02:00
<para>
<xref linkend="sql-notify" endterm="sql-notify-ref">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
1998-10-08 02:19:13 +02:00
<REFSECT2 ID="R2-SQL-UNLISTEN-3">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
1998-10-08 02:19:13 +02:00
<para>
<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE>
needs not to be a valid class name but can be any string valid
as a name up to 32 characters long.
</para>
<para>
The backend does not complain if you UNLISTEN something you were not
listening for.
Each backend will automatically execute <command>UNLISTEN *</command> when
1998-10-08 02:19:13 +02:00
exiting.
</para>
1998-10-08 02:19:13 +02:00
<para>
A restriction in some previous releases of
<productname>Postgres</productname> that a
<REPLACEABLE CLASS="PARAMETER">classname</REPLACEABLE>
which does not correspond to an actual table must be enclosed in double-quotes
is no longer present.
</para>
</REFSECT2>
</refsect1>
1998-10-08 02:19:13 +02:00
<REFSECT1 ID="R1-SQL-UNLISTEN-2">
<TITLE>
Usage
</TITLE>
<para>
<programlisting>
postgres=> LISTEN virtual;
1998-10-08 02:19:13 +02:00
LISTEN
postgres=> NOTIFY virtual;
1998-10-08 02:19:13 +02:00
NOTIFY
ASYNC NOTIFY of 'virtual' from backend pid '12317' received
</programlisting>
<programlisting>
postgres=> UNLISTEN virtual;
1998-10-08 02:19:13 +02:00
UNLISTEN
postgres=> NOTIFY virtual;
1998-10-08 02:19:13 +02:00
NOTIFY
-- notice no NOTIFY event is received
postgres=>
</programlisting>
</para>
1998-10-08 02:19:13 +02:00
</REFSECT1>
<REFSECT1 ID="R1-SQL-UNLISTEN-3">
<TITLE>
Compatibility
</TITLE>
<REFSECT2 ID="R2-SQL-UNLISTEN-4">
<REFSECT2INFO>
<DATE>1998-10-19</DATE>
1998-10-08 02:19:13 +02:00
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
1998-10-08 02:19:13 +02:00
</REFENTRY>