我觉得它是某种特殊的数据库,是服务器正常运行所必需的,但它的目的究竟是什么呢?内部存储(或可能存储)哪种数据?它是否包含有关其他数据库的元数据(例如information_schema?).如果我从公共中撤销对此数据库的连接权限,是否会发生令人讨厌的事情?或者,如果我甚至放弃它?
我用谷歌搜索了半个小时,但总是得到完全不相关的东西,因为postgres这个词也用于用户postgres和DBMS本身.
Since you need to be connected to the database server in order to execute the
CREATE DATABASE@H_502_12@ command,the question remains how the first database at any given site can be created. The first database is always created by the
initdb@H_502_12@ command when the data storage area is initialized. (See Section 17.2.) This database is called
postgres@H_502_12@. So to create the first “ordinary” database you can connect to
postgres@H_502_12@.
Note:
template1@H_502_12@ and
template0@H_502_12@ do not have any special status beyond the fact that the name
template1@H_502_12@ is the default source database name for
CREATE DATABASE@H_502_12@. For example,one could drop
template1@H_502_12@ and recreate it from
template0@H_502_12@ without any ill effects. This course of action might be advisable if one has carelessly added a bunch of junk in
template1@H_502_12@. (To delete
template1@H_502_12@,it must have
pg_database.datistemplate = false@H_502_12@.)
The
postgres@H_502_12@ database
is also created when a database cluster is initialized. This database is meant as a default database for users and applications to connect to. It is simply a copy oftemplate1@H_502_12@ and can be dropped and recreated if necessary.