Regression tests for LISTEN/NOTIFY/UNLISTEN/pg_notify.
authorRobert Haas <rhaas@postgresql.org>
Wed, 3 Jul 2013 15:06:45 +0000 (11:06 -0400)
committerRobert Haas <rhaas@postgresql.org>
Wed, 3 Jul 2013 15:07:08 +0000 (11:07 -0400)
Robins Tharakan, reviewed by Szymon Guz

src/test/regress/expected/async.out [new file with mode: 0644]
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/async.sql [new file with mode: 0644]

diff --git a/src/test/regress/expected/async.out b/src/test/regress/expected/async.out
new file mode 100644 (file)
index 0000000..ae0d5df
--- /dev/null
@@ -0,0 +1,34 @@
+--
+-- 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;
+UNLISTEN notify_async2;
+UNLISTEN *;
index 4bb9cc78579258bbae1c40666e71395d1ffb217b..3e6b3065400cecceb8208187ba4a6817b38d6523 100644 (file)
@@ -88,7 +88,7 @@ test: privileges security_label collate matview
 # ----------
 # Another group of parallel tests
 # ----------
-test: alter_generic misc psql
+test: alter_generic misc psql async
 
 # rules cannot run concurrently with any test that creates a view
 test: rules
index ceeca734d3a26c1dc8713e00af4f31b264570877..3ad289fee004740830f7bbcda36667e937b96782 100644 (file)
@@ -99,6 +99,7 @@ test: matview
 test: alter_generic
 test: misc
 test: psql
+test: async
 test: rules
 test: event_trigger
 test: select_views
diff --git a/src/test/regress/sql/async.sql b/src/test/regress/sql/async.sql
new file mode 100644 (file)
index 0000000..af3a904
--- /dev/null
@@ -0,0 +1,19 @@
+--
+-- ASYNC
+--
+
+--Should work. Send a valid message via a valid channel name
+SELECT pg_notify('notify_async1','sample message1');
+SELECT pg_notify('notify_async1','');
+SELECT pg_notify('notify_async1',NULL);
+
+-- Should fail. Send a valid message via an invalid channel name
+SELECT pg_notify('','sample message1');
+SELECT pg_notify(NULL,'sample message1');
+SELECT pg_notify('notify_async_channel_name_too_long______________________________','sample_message1');
+
+--Should work. Valid NOTIFY/LISTEN/UNLISTEN commands
+NOTIFY notify_async2;
+LISTEN notify_async2;
+UNLISTEN notify_async2;
+UNLISTEN *;