dblink_close

Name

dblink_close -- closes a cursor on a remote database

Synopsis

 dblink_close(text cursorname [, bool fail_on_error])
 dblink_close(text connname, text cursorname [, bool fail_on_error])
   

Inputs

connname

if two arguments are present, the first is taken as the specific connection name to use; otherwise the unnamed connection is assumed

cursorname

a reference name for the cursor

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 = "OK"

Note

dblink_connect(text connstr) or dblink_connect(text connname, text connstr) must be executed first.

Example

 test=# select dblink_connect('dbname=postgres');
  dblink_connect
 ----------------
  OK
 (1 row)
 
 test=# select dblink_open('foo','select proname, prosrc from pg_proc');
  dblink_open
 -------------
  OK
 (1 row)
 
 test=# select dblink_close('foo');
  dblink_close
 --------------
  OK
 (1 row)
 
 select dblink_connect('myconn','dbname=regression');
  dblink_connect
 ----------------
  OK
 (1 row)
 
 select dblink_open('myconn','foo','select proname, prosrc from pg_proc');
  dblink_open
 -------------
  OK
 (1 row)
 
 select dblink_close('myconn','foo');
  dblink_close
 --------------
  OK
 (1 row)