aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2013-07-03 11:06:45 -0400
committerRobert Haas <rhaas@postgresql.org>2013-07-03 11:07:08 -0400
commit00a7767fcc2e4d90e3b4cacb87974ec5a0f32b8c (patch)
tree81c62a5b9cb9c174a90ea29c023dccea4eb1167a /src
parentada3e776c2a4825ed0387e4bcf335139b101ca98 (diff)
downloadpostgresql-00a7767fcc2e4d90e3b4cacb87974ec5a0f32b8c.tar.gz
postgresql-00a7767fcc2e4d90e3b4cacb87974ec5a0f32b8c.zip
Regression tests for LISTEN/NOTIFY/UNLISTEN/pg_notify.
Robins Tharakan, reviewed by Szymon Guz
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/async.out34
-rw-r--r--src/test/regress/parallel_schedule2
-rw-r--r--src/test/regress/serial_schedule1
-rw-r--r--src/test/regress/sql/async.sql19
4 files changed, 55 insertions, 1 deletions
diff --git a/src/test/regress/expected/async.out b/src/test/regress/expected/async.out
new file mode 100644
index 00000000000..ae0d5df3b78
--- /dev/null
+++ b/src/test/regress/expected/async.out
@@ -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 *;
diff --git a/src/test/regress/parallel_schedule b/src/test/regress/parallel_schedule
index 4bb9cc78579..3e6b3065400 100644
--- a/src/test/regress/parallel_schedule
+++ b/src/test/regress/parallel_schedule
@@ -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
diff --git a/src/test/regress/serial_schedule b/src/test/regress/serial_schedule
index ceeca734d3a..3ad289fee00 100644
--- a/src/test/regress/serial_schedule
+++ b/src/test/regress/serial_schedule
@@ -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
index 00000000000..af3a904e0f5
--- /dev/null
+++ b/src/test/regress/sql/async.sql
@@ -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 *;