mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-28 23:27:29 +02:00
unlike template0 and template1 does not have any special status in terms of backend functionality. However, all external utilities such as createuser and createdb now connect to "postgres" instead of template1, and the documentation is changed to encourage people to use "postgres" instead of template1 as a play area. This should fix some longstanding gotchas involving unexpected propagation of database objects by createdb (when you used template1 without understanding the implications), as well as ameliorating the problem that CREATE DATABASE is unhappy if anyone else is connected to template1. Patch by Dave Page, minor editing by Tom Lane. All per recent pghackers discussions.
76 lines
1.4 KiB
Plaintext
76 lines
1.4 KiB
Plaintext
==================================================================
|
|
Name
|
|
|
|
dblink_connect -- Opens a persistent connection to a remote database
|
|
|
|
Synopsis
|
|
|
|
dblink_connect(text connstr)
|
|
dblink_connect(text connname, text connstr)
|
|
|
|
Inputs
|
|
|
|
connname
|
|
if 2 arguments are given, the first is used as a name for a persistent
|
|
connection
|
|
|
|
connstr
|
|
|
|
standard libpq format connection string,
|
|
e.g. "hostaddr=127.0.0.1 port=5432 dbname=mydb user=postgres password=mypasswd"
|
|
|
|
if only one argument is given, the connection is unnamed; only one unnamed
|
|
connection can exist at a time
|
|
|
|
Outputs
|
|
|
|
Returns status = "OK"
|
|
|
|
Example usage
|
|
|
|
select dblink_connect('dbname=postgres');
|
|
dblink_connect
|
|
----------------
|
|
OK
|
|
(1 row)
|
|
|
|
select dblink_connect('myconn','dbname=postgres');
|
|
dblink_connect
|
|
----------------
|
|
OK
|
|
(1 row)
|
|
|
|
==================================================================
|
|
Name
|
|
|
|
dblink_disconnect -- Closes a persistent connection to a remote database
|
|
|
|
Synopsis
|
|
|
|
dblink_disconnect()
|
|
dblink_disconnect(text connname)
|
|
|
|
Inputs
|
|
|
|
connname
|
|
if an argument is given, it is used as a name for a persistent
|
|
connection to close; otherwiase the unnamed connection is closed
|
|
|
|
Outputs
|
|
|
|
Returns status = "OK"
|
|
|
|
Example usage
|
|
|
|
test=# select dblink_disconnect();
|
|
dblink_disconnect
|
|
-------------------
|
|
OK
|
|
(1 row)
|
|
|
|
select dblink_disconnect('myconn');
|
|
dblink_disconnect
|
|
-------------------
|
|
OK
|
|
(1 row)
|