Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
--
-- ASYNC
--
--Should work. Send a valid message via a valid channel name
SELECT pg_notify('notify_async1','sample message1');
 pg_notify 
-----------
 
(1 row)
 
SELECT pg_notify('notify_async1','');
 pg_notify 
-----------
 
(1 row)
 
SELECT pg_notify('notify_async1',NULL);
 pg_notify 
-----------
 
(1 row)
 
-- Should fail. Send a valid message via an invalid channel name
SELECT pg_notify('','sample message1');
ERROR:  channel name cannot be empty
SELECT pg_notify(NULL,'sample message1');
ERROR:  channel name cannot be empty
SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
ERROR:  channel name too long
--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
NOTIFY notify_async2;
LISTEN notify_async2;
-- Check cleanup when a target-list SRF is abandoned early.
SELECT pg_listening_channels() LIMIT 1;
 pg_listening_channels 
-----------------------
 notify_async2
(1 row)
 
UNLISTEN notify_async2;
UNLISTEN *;
-- Should return zero while there are no pending notifications.
-- src/test/isolation/specs/async-notify.spec tests for actual usage.
SELECT pg_notification_queue_usage();
 pg_notification_queue_usage 
-----------------------------
                           0
(1 row)