Postgresql 中文操作指南
Description
UNLISTEN 用于移除对 NOTIFY 事件的现有注册。 UNLISTEN 取消任何将当前 PostgreSQL 会话注册为名为 channel 的通知信道上的侦听器的现有注册。特殊通配符 * 会取消当前会话的所有侦听器注册。
UNLISTEN is used to remove an existing registration for NOTIFY events. UNLISTEN cancels any existing registration of the current PostgreSQL session as a listener on the notification channel named channel. The special wildcard * cancels all listener registrations for the current session.
NOTIFY 对使用 LISTEN 和 NOTIFY 做了更广泛的讨论。
NOTIFY contains a more extensive discussion of the use of LISTEN and NOTIFY.
Parameters
-
channel
-
Name of a notification channel (any identifier).
-
-
*
-
All current listen registrations for this session are cleared.
-
Notes
你可以取消未收听的收听;不会显示警告或错误。
You can unlisten something you were not listening for; no warning or error will appear.
在每个会话的末尾,自动执行 UNLISTEN * 。
At the end of each session, UNLISTEN * is automatically executed.
已经执行 UNLISTEN 的事务不能准备用于两阶段提交。
A transaction that has executed UNLISTEN cannot be prepared for two-phase commit.
Examples
进行注册:
To make a registration:
LISTEN virtual;
NOTIFY virtual;
Asynchronous notification "virtual" received from server process with PID 8448.
一旦执行了 UNLISTEN ,系统将忽略其他 NOTIFY 消息:
Once UNLISTEN has been executed, further NOTIFY messages will be ignored:
UNLISTEN virtual;
NOTIFY virtual;
-- no NOTIFY event is received