如何确定默认情况下创建了哪些数据库,模式和表? [英] How can I find out which databases, schemas and tables were created by default?
问题描述
我想找出默认情况下创建了哪些数据库,模式和表。我想知道该怎么做?
I would like to find out which databases, schemas and tables were created by default. I was wondering how to do that?
我使用 \l
,但无法从输出中分辨出来。
I use \l
but can't tell from its output. Thanks.
$ sudo -u postgres psql
postgres=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
--------------+----------+----------+-------------+-------------+-----------------------
linuxhowtodb | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
students | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(5 rows)
推荐答案
创建数据库 template0
, template1
和 postgres
默认情况下,当您 initdb
时。
The databases template0
, template1
and postgres
are created by default when you initdb
.
数据库 postgres
用于管理连接,在创建新数据库而不指定显式模板时, template1
将用作默认模板,而 template0
是您需要确实空数据库时使用的模板。
The database postgres
is for administrative connections, template1
will be used as default template when you create a new database without specifying an explicit template, and template0
is the template you use if you need a really empty database.
这篇关于如何确定默认情况下创建了哪些数据库,模式和表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!