mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Cause initdb to create a third standard database "postgres", which
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.
This commit is contained in:
@ -37,7 +37,7 @@ Outputs
|
||||
|
||||
Example usage
|
||||
|
||||
select * from dblink('dbname=template1','select proname, prosrc from pg_proc')
|
||||
select * from dblink('dbname=postgres','select proname, prosrc from pg_proc')
|
||||
as t1(proname name, prosrc text) where proname like 'bytea%';
|
||||
proname | prosrc
|
||||
------------+------------
|
||||
@ -55,7 +55,7 @@ select * from dblink('dbname=template1','select proname, prosrc from pg_proc')
|
||||
byteaout | byteaout
|
||||
(12 rows)
|
||||
|
||||
select dblink_connect('dbname=template1');
|
||||
select dblink_connect('dbname=postgres');
|
||||
dblink_connect
|
||||
----------------
|
||||
OK
|
||||
@ -111,7 +111,7 @@ A more convenient way to use dblink may be to create a view:
|
||||
|
||||
create view myremote_pg_proc as
|
||||
select *
|
||||
from dblink('dbname=template1','select proname, prosrc from pg_proc')
|
||||
from dblink('dbname=postgres','select proname, prosrc from pg_proc')
|
||||
as t1(proname name, prosrc text);
|
||||
|
||||
Then you can simply write:
|
||||
|
Reference in New Issue
Block a user