mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-06 15:24:56 +08:00
Regression tests for LISTEN/NOTIFY/UNLISTEN/pg_notify.
Robins Tharakan, reviewed by Szymon Guz
This commit is contained in:
parent
ada3e776c2
commit
00a7767fcc
34
src/test/regress/expected/async.out
Normal file
34
src/test/regress/expected/async.out
Normal file
@ -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 *;
|
@ -88,7 +88,7 @@ test: privileges security_label collate matview
|
|||||||
# ----------
|
# ----------
|
||||||
# Another group of parallel tests
|
# 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
|
# rules cannot run concurrently with any test that creates a view
|
||||||
test: rules
|
test: rules
|
||||||
|
@ -99,6 +99,7 @@ test: matview
|
|||||||
test: alter_generic
|
test: alter_generic
|
||||||
test: misc
|
test: misc
|
||||||
test: psql
|
test: psql
|
||||||
|
test: async
|
||||||
test: rules
|
test: rules
|
||||||
test: event_trigger
|
test: event_trigger
|
||||||
test: select_views
|
test: select_views
|
||||||
|
19
src/test/regress/sql/async.sql
Normal file
19
src/test/regress/sql/async.sql
Normal file
@ -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 *;
|
Loading…
Reference in New Issue
Block a user