pg_listening_channels()

A function listing current notification channels

pg_listening_channels() is a system function returning the synchronous notification channels that the current session is listening to.

pg_listening_channels() was added in PostgreSQL 9.0.

Usage

pg_listening_channels () → setof text

Change history

Examples

Usage example for pg_listening_channels():

postgres=# LISTEN foo;
LISTEN

postgres=# LISTEN bar;
LISTEN

postgres=# SELECT * FROM pg_listening_channels();
 pg_listening_channels 
-----------------------
 foo
 bar
(2 rows)

postgres=# UNLISTEN bar;
UNLISTEN

postgres=# SELECT * FROM pg_listening_channels();
 pg_listening_channels 
-----------------------
 foo
(1 row)

Categories

Asynchronous notifications, System function

See also

LISTEN, UNLISTEN