1--
2-- ASYNC
3--
4--Should work. Send a valid message via a valid channel name
5SELECT pg_notify('notify_async1','sample message1');
6 pg_notify
7-----------
8
9(1 row)
10
11SELECT pg_notify('notify_async1','');
12 pg_notify
13-----------
14
15(1 row)
16
17SELECT pg_notify('notify_async1',NULL);
18 pg_notify
19-----------
20
21(1 row)
22
23-- Should fail. Send a valid message via an invalid channel name
24SELECT pg_notify('','sample message1');
25ERROR:  channel name cannot be empty
26SELECT pg_notify(NULL,'sample message1');
27ERROR:  channel name cannot be empty
28SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
29ERROR:  channel name too long
30--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
31NOTIFY notify_async2;
32LISTEN notify_async2;
33UNLISTEN notify_async2;
34UNLISTEN *;
35-- Should return zero while there are no pending notifications.
36-- src/test/isolation/specs/async-notify.spec tests for actual usage.
37SELECT pg_notification_queue_usage();
38 pg_notification_queue_usage
39-----------------------------
40                           0
41(1 row)
42
43