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

194 lines
4.2 KiB
Plaintext
Raw Normal View History

<!--
2002-09-21 20:32:54 +02:00
$Header: /cvsroot/pgsql/doc/src/sgml/ref/unlisten.sgml,v 1.20 2002/09/21 18:32:54 petere Exp $
PostgreSQL documentation
-->
<refentry id="SQL-UNLISTEN">
<refmeta>
<refentrytitle>UNLISTEN</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>
UNLISTEN
</refname>
<refpurpose>
stop listening for a notification
</refpurpose>
</refnamediv>
<refsynopsisdiv>
<refsynopsisdivinfo>
<date>1998-10-19</date>
</refsynopsisdivinfo>
<synopsis>
UNLISTEN { <replaceable class="PARAMETER">notifyname</replaceable> | * }
</synopsis>
<refsect2 id="R2-SQL-UNLISTEN-1">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Inputs
</title>
<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>
</variablelist>
</para>
</refsect2>
<refsect2 id="R2-SQL-UNLISTEN-2">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist>
<varlistentry>
<term><computeroutput>
1998-10-08 02:19:13 +02:00
<returnvalue>UNLISTEN</returnvalue>
</computeroutput></term>
<listitem>
<para>
Acknowledgment that statement has executed.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-UNLISTEN-1">
<refsect1info>
<date>1998-10-19</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>UNLISTEN</command>
is used to remove an existing <command>NOTIFY</command> registration.
2002-09-21 20:32:54 +02:00
<command>UNLISTEN</command> cancels any existing registration of the current
<productname>PostgreSQL</productname> session as a listener on the notify
condition <replaceable class="PARAMETER">notifyname</replaceable>.
The special condition wildcard <literal>*</literal> cancels all listener registrations
for the current session.
</para>
<para>
<xref endterm="sql-notify-title" linkend="sql-notify">
contains a more extensive
discussion of the use of <command>LISTEN</command> and
<command>NOTIFY</command>.
</para>
<refsect2 id="R2-SQL-UNLISTEN-3">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
Notes
</title>
<para>
<replaceable class="PARAMETER">notifyname</replaceable>
need not be a valid class name but can be any string valid
as a name up to 64 characters long.
</para>
<para>
2002-09-21 20:32:54 +02:00
The backend does not complain if you unlisten something you were not
listening for.
Each backend will automatically execute <command>UNLISTEN *</command> when
exiting.
</para>
</refsect2>
</refsect1>
<refsect1 id="R1-SQL-UNLISTEN-2">
<title>
Usage
</title>
<para>
To subscribe to an existing registration:
<programlisting>
2000-07-21 06:49:23 +02:00
LISTEN virtual;
1998-10-08 02:19:13 +02:00
LISTEN
2000-07-21 06:49:23 +02:00
NOTIFY virtual;
1998-10-08 02:19:13 +02:00
NOTIFY
Asynchronous NOTIFY 'virtual' from backend with pid '8448' received
</programlisting>
</para>
<para>
2002-09-21 20:32:54 +02:00
Once <command>UNLISTEN</> has been executed, further <command>NOTIFY</> commands will be
ignored:
<programlisting>
2000-07-21 06:48:33 +02:00
UNLISTEN virtual;
1998-10-08 02:19:13 +02:00
UNLISTEN
2000-07-21 06:48:33 +02:00
NOTIFY virtual;
1998-10-08 02:19:13 +02:00
NOTIFY
-- notice no NOTIFY event is received
</programlisting>
</para>
</refsect1>
<refsect1 id="R1-SQL-UNLISTEN-3">
<title>
Compatibility
</title>
<refsect2 id="R2-SQL-UNLISTEN-4">
<refsect2info>
<date>1998-10-19</date>
</refsect2info>
<title>
SQL92
</title>
<para>
There is no <command>UNLISTEN</command> in <acronym>SQL92</acronym>.
</para>
</refsect2>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->