summaryrefslogtreecommitdiff
path: root/contrib/dblink/doc/execute
diff options
context:
space:
mode:
authorJoe Conway <mail@joeconway.com>2004-03-07 02:27:00 +0000
committerJoe Conway <mail@joeconway.com>2004-03-07 02:27:00 +0000
commit6a1e2b3c2884eb842a7af5f0f92a01c2a7ee7ac9 (patch)
tree4dc74bf2840a533a73be7b1bfbf0ebe04c82ce89 /contrib/dblink/doc/execute
parentcb659ecb409ae94941568e8216ab81a7331c5443 (diff)
downloadpostgresql-6a1e2b3c2884eb842a7af5f0f92a01c2a7ee7ac9.tar.gz
Added new versions of dblink, dblink_exec, dblink_open, dblink_close,
and, dblink_fetch -- allows ERROR on remote side of connection to throw NOTICE locally instead of ERROR. Also removed documentation for previously deprecated, now removed, functions.
Diffstat (limited to 'contrib/dblink/doc/execute')
-rw-r--r--contrib/dblink/doc/execute25
1 files changed, 21 insertions, 4 deletions
diff --git a/contrib/dblink/doc/execute b/contrib/dblink/doc/execute
index 72a21276d9..d4c09b22de 100644
--- a/contrib/dblink/doc/execute
+++ b/contrib/dblink/doc/execute
@@ -5,14 +5,15 @@ dblink_exec -- Executes an UPDATE/INSERT/DELETE on a remote database
Synopsis
-dblink_exec(text connstr, text sql)
-dblink_exec(text connname, text sql)
-dblink_exec(text sql)
+dblink_exec(text connstr, text sql [, bool fail_on_error])
+dblink_exec(text connname, text sql [, bool fail_on_error])
+dblink_exec(text sql [, bool fail_on_error])
Inputs
connname
connstr
+
If two arguments are present, the first is first assumed to be a specific
connection name to use. If the name is not found, the argument is then
assumed to be a valid connection string, of standard libpq format,
@@ -25,9 +26,16 @@ Inputs
sql statement that you wish to execute on the remote host, e.g.:
insert into foo values(0,'a','{"a0","b0","c0"}');
+ fail_on_error
+
+ If true (default when not present) then an ERROR thrown on the remote side
+ of the connection causes an ERROR to also be thrown locally. If false, the
+ remote ERROR is locally treated as a NOTICE, and the return value is set
+ to 'ERROR'.
+
Outputs
- Returns status of the command
+ Returns status of the command, or 'ERROR' if the command failed.
Notes
1) dblink_open starts an explicit transaction. If, after using dblink_open,
@@ -60,3 +68,12 @@ select dblink_exec('myconn','insert into foo values(21,''z'',''{"a0","b0","c0"}'
------------------
INSERT 6432584 1
(1 row)
+
+select dblink_exec('myconn','insert into pg_class values (''foo'')',false);
+NOTICE: sql error
+DETAIL: ERROR: null value in column "relnamespace" violates not-null constraint
+
+ dblink_exec
+-------------
+ ERROR
+(1 row)