4 dblink_open — opens a cursor in a remote database
8 dblink_open(text cursorname, text sql [, bool fail_on_error]) returns text
9 dblink_open(text connname, text cursorname, text sql [, bool fail_on_error]) ret
14 dblink_open() opens a cursor in a remote database. The cursor can
15 subsequently be manipulated with dblink_fetch() and dblink_close().
20 Name of the connection to use; omit this parameter to use the
24 The name to assign to this cursor.
27 The SELECT statement that you wish to execute in the remote
28 database, for example select * from pg_class.
31 If true (the default when omitted) then an error thrown on the
32 remote side of the connection causes an error to also be thrown
33 locally. If false, the remote error is locally reported as a
34 NOTICE, and the function's return value is set to ERROR.
38 Returns status, either OK or ERROR.
42 Since a cursor can only persist within a transaction, dblink_open
43 starts an explicit transaction block (BEGIN) on the remote side, if the
44 remote side was not already within a transaction. This transaction will
45 be closed again when the matching dblink_close is executed. Note that
46 if you use dblink_exec to change data between dblink_open and
47 dblink_close, and then an error occurs or you use dblink_disconnect
48 before dblink_close, your change will be lost because the transaction
53 SELECT dblink_connect('dbname=postgres options=-csearch_path=');
59 SELECT dblink_open('foo', 'select proname, prosrc from pg_proc');