summaryrefslogtreecommitdiff
path: root/contrib/dblink/expected
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2009-08-05 16:11:07 +0000
committerJoe Conway <mail@joeconway.com>2009-08-05 16:11:07 +0000
commitf4095b4c4b24a6fd2c1c330e572c24c6a9c99ea9 (patch)
treeddc3c8603474fd2d3c5a0c3de693383825495fd1 /contrib/dblink/expected
parent16f3cf8c0c3c452ff06a3267b2f13bf0bd3b3892 (diff)
downloadpostgresql-f4095b4c4b24a6fd2c1c330e572c24c6a9c99ea9.tar.gz
Implement dblink_get_notify().
Adds the ability to retrieve async notifications using dblink, via the addition of the function dblink_get_notify(). Original patch by Marcus Kempe, suggestions by Tom Lane and Alvaro Herrera, patch review and adjustments by Joe Conway.
Diffstat (limited to 'contrib/dblink/expected')
-rw-r--r--contrib/dblink/expected/dblink.out51
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/dblink/expected/dblink.out b/contrib/dblink/expected/dblink.out
index 102444d88c..13e4a6fb4c 100644
--- a/contrib/dblink/expected/dblink.out
+++ b/contrib/dblink/expected/dblink.out
@@ -827,3 +827,54 @@ DROP USER dblink_regression_test;
DROP USER MAPPING FOR public SERVER fdtest;
DROP SERVER fdtest;
DROP FOREIGN DATA WRAPPER postgresql;
+-- test asynchronous notifications
+SELECT dblink_connect('dbname=contrib_regression');
+ dblink_connect
+----------------
+ OK
+(1 row)
+
+--should return listen
+SELECT dblink_exec('LISTEN regression');
+ dblink_exec
+-------------
+ LISTEN
+(1 row)
+
+--should return listen
+SELECT dblink_exec('LISTEN foobar');
+ dblink_exec
+-------------
+ LISTEN
+(1 row)
+
+SELECT dblink_exec('NOTIFY regression');
+ dblink_exec
+-------------
+ NOTIFY
+(1 row)
+
+SELECT dblink_exec('NOTIFY foobar');
+ dblink_exec
+-------------
+ NOTIFY
+(1 row)
+
+SELECT notify_name, be_pid = (select t.be_pid from dblink('select pg_backend_pid()') as t(be_pid int)) AS is_self_notify, extra from dblink_get_notify();
+ notify_name | is_self_notify | extra
+-------------+----------------+-------
+ regression | t |
+ foobar | t |
+(2 rows)
+
+SELECT * from dblink_get_notify();
+ notify_name | be_pid | extra
+-------------+--------+-------
+(0 rows)
+
+SELECT dblink_disconnect();
+ dblink_disconnect
+-------------------
+ OK
+(1 row)
+