Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 00a7767

Browse files
committed
Regression tests for LISTEN/NOTIFY/UNLISTEN/pg_notify.
Robins Tharakan, reviewed by Szymon Guz
1 parent ada3e77 commit 00a7767

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

src/test/regress/expected/async.out

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--
2+
-- ASYNC
3+
--
4+
--Should work. Send a valid message via a valid channel name
5+
SELECT pg_notify('notify_async1','sample message1');
6+
pg_notify
7+
-----------
8+
9+
(1 row)
10+
11+
SELECT pg_notify('notify_async1','');
12+
pg_notify
13+
-----------
14+
15+
(1 row)
16+
17+
SELECT 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
24+
SELECT pg_notify('','sample message1');
25+
ERROR: channel name cannot be empty
26+
SELECT pg_notify(NULL,'sample message1');
27+
ERROR: channel name cannot be empty
28+
SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
29+
ERROR: channel name too long
30+
--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
31+
NOTIFY notify_async2;
32+
LISTEN notify_async2;
33+
UNLISTEN notify_async2;
34+
UNLISTEN *;

src/test/regress/parallel_schedule

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ test: privileges security_label collate matview
8888
# ----------
8989
# Another group of parallel tests
9090
# ----------
91-
test: alter_generic misc psql
91+
test: alter_generic misc psql async
9292

9393
# rules cannot run concurrently with any test that creates a view
9494
test: rules

src/test/regress/serial_schedule

+1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ test: matview
9999
test: alter_generic
100100
test: misc
101101
test: psql
102+
test: async
102103
test: rules
103104
test: event_trigger
104105
test: select_views

src/test/regress/sql/async.sql

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--
2+
-- ASYNC
3+
--
4+
5+
--Should work. Send a valid message via a valid channel name
6+
SELECT pg_notify('notify_async1','sample message1');
7+
SELECT pg_notify('notify_async1','');
8+
SELECT pg_notify('notify_async1',NULL);
9+
10+
-- Should fail. Send a valid message via an invalid channel name
11+
SELECT pg_notify('','sample message1');
12+
SELECT pg_notify(NULL,'sample message1');
13+
SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
14+
15+
--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
16+
NOTIFY notify_async2;
17+
LISTEN notify_async2;
18+
UNLISTEN notify_async2;
19+
UNLISTEN *;

0 commit comments

Comments
 (0)