diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:44:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 13:44:03 +0000 |
commit | 293913568e6a7a86fd1479e1cff8e2ecb58d6568 (patch) | |
tree | fc3b469a3ec5ab71b36ea97cc7aaddb838423a0c /doc/src/sgml/man3/dblink_exec.3 | |
parent | Initial commit. (diff) | |
download | postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.tar.xz postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.zip |
Adding upstream version 16.2.upstream/16.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'doc/src/sgml/man3/dblink_exec.3')
-rw-r--r-- | doc/src/sgml/man3/dblink_exec.3 | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/doc/src/sgml/man3/dblink_exec.3 b/doc/src/sgml/man3/dblink_exec.3 new file mode 100644 index 0000000..6b0b9e8 --- /dev/null +++ b/doc/src/sgml/man3/dblink_exec.3 @@ -0,0 +1,117 @@ +'\" t +.\" Title: dblink_exec +.\" Author: The PostgreSQL Global Development Group +.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/> +.\" Date: 2024 +.\" Manual: PostgreSQL 16.2 Documentation +.\" Source: PostgreSQL 16.2 +.\" Language: English +.\" +.TH "DBLINK_EXEC" "3" "2024" "PostgreSQL 16.2" "PostgreSQL 16.2 Documentation" +.\" ----------------------------------------------------------------- +.\" * Define some portability stuff +.\" ----------------------------------------------------------------- +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.\" http://bugs.debian.org/507673 +.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html +.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +.ie \n(.g .ds Aq \(aq +.el .ds Aq ' +.\" ----------------------------------------------------------------- +.\" * set default formatting +.\" ----------------------------------------------------------------- +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.\" ----------------------------------------------------------------- +.\" * MAIN CONTENT STARTS HERE * +.\" ----------------------------------------------------------------- +.SH "NAME" +dblink_exec \- executes a command in a remote database +.SH "SYNOPSIS" +.sp +.nf +dblink_exec(text connname, text sql [, bool fail_on_error]) returns text +dblink_exec(text connstr, text sql [, bool fail_on_error]) returns text +dblink_exec(text sql [, bool fail_on_error]) returns text +.fi +.SH "DESCRIPTION" +.PP +\fBdblink_exec\fR +executes a command (that is, any SQL statement that doesn\*(Aqt return rows) in a remote database\&. +.PP +When two +text +arguments are given, the first one is first looked up as a persistent connection\*(Aqs name; if found, the command is executed on that connection\&. If not found, the first argument is treated as a connection info string as for +\fBdblink_connect\fR, and the indicated connection is made just for the duration of this command\&. +.SH "ARGUMENTS" +.PP +\fIconnname\fR +.RS 4 +Name of the connection to use; omit this parameter to use the unnamed connection\&. +.RE +.PP +\fIconnstr\fR +.RS 4 +A connection info string, as previously described for +\fBdblink_connect\fR\&. +.RE +.PP +\fIsql\fR +.RS 4 +The SQL command that you wish to execute in the remote database, for example +insert into foo values(0, \*(Aqa\*(Aq, \*(Aq{"a0","b0","c0"}\*(Aq)\&. +.RE +.PP +\fIfail_on_error\fR +.RS 4 +If true (the default when omitted) 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 reported as a NOTICE, and the function\*(Aqs return value is set to +ERROR\&. +.RE +.SH "RETURN VALUE" +.PP +Returns status, either the command\*(Aqs status string or +ERROR\&. +.SH "EXAMPLES" +.sp +.if n \{\ +.RS 4 +.\} +.nf +SELECT dblink_connect(\*(Aqdbname=dblink_test_standby\*(Aq); + dblink_connect +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + OK +(1 row) + +SELECT dblink_exec(\*(Aqinsert into foo values(21, \*(Aq\*(Aqz\*(Aq\*(Aq, \*(Aq\*(Aq{"a0","b0","c0"}\*(Aq\*(Aq);\*(Aq); + dblink_exec +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + INSERT 943366 1 +(1 row) + +SELECT dblink_connect(\*(Aqmyconn\*(Aq, \*(Aqdbname=regression\*(Aq); + dblink_connect +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + OK +(1 row) + +SELECT dblink_exec(\*(Aqmyconn\*(Aq, \*(Aqinsert into foo values(21, \*(Aq\*(Aqz\*(Aq\*(Aq, \*(Aq\*(Aq{"a0","b0","c0"}\*(Aq\*(Aq);\*(Aq); + dblink_exec +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + INSERT 6432584 1 +(1 row) + +SELECT dblink_exec(\*(Aqmyconn\*(Aq, \*(Aqinsert into pg_class values (\*(Aq\*(Aqfoo\*(Aq\*(Aq)\*(Aq,false); +NOTICE: sql error +DETAIL: ERROR: null value in column "relnamespace" violates not\-null constraint + + dblink_exec +\-\-\-\-\-\-\-\-\-\-\-\-\- + ERROR +(1 row) +.fi +.if n \{\ +.RE +.\} |