我对在PostgreSQL中找到数据库位置的位置感到困惑。
我知道命令SHOW data_directory
。具体来说,我在位置data/postgres
中设置了一个集群。当我连接到该集群并在其中创建数据库时,SHOW data_directory
返回以下结果:
yql@ubuntu1804:/data/postgresdb$ sudo -u postgres psql -p 5433
Password:
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1))
Type "help" for help.
postgres=# \c sample
You are now connected to database "sample" as user "postgres".
sample=# show data_directory;
data_directory
----------------
/postgresdb
(1 row)
使用\dt
列出以下结果,因此数据库不应为空:
List of relations
Schema | Name | Type | Owner
--------+--------------------------+-------+----------
citydb | address | table | postgres
citydb | address_to_bridge | table | postgres
citydb | address_to_building | table | postgres
citydb | ade | table | postgres
citydb | aggregation_info | table | postgres
citydb | appear_to_surface_data | table | postgres
citydb | appearance | table | postgres
citydb | breakline_relief | table | postgres
citydb | bridge | table | postgres
citydb | bridge_constr_element | table | postgres
citydb | bridge_furniture | table | postgres
citydb | bridge_installation | table | postgres
citydb | bridge_open_to_them_srf | table | postgres
citydb | bridge_opening | table | postgres
citydb | bridge_room | table | postgres
citydb | bridge_thematic_surface | table | postgres
citydb | building | table | postgres
citydb | building_furniture | table | postgres
citydb | building_installation | table | postgres
citydb | city_furniture | table | postgres
citydb | citymodel | table | postgres
citydb | cityobject | table | postgres
citydb | cityobject_genericattrib | table | postgres
citydb | cityobject_member | table | postgres
citydb | cityobjectgroup | table | postgres
citydb | database_srs | table | postgres
citydb | external_reference | table | postgres
citydb | generalization | table | postgres
citydb | generic_cityobject | table | postgres
citydb | grid_coverage | table | postgres
citydb | group_to_cityobject | table | postgres
citydb | implicit_geometry | table | postgres
citydb | index_table | table | postgres
citydb | land_use | table | postgres
citydb | masspoint_relief | table | postgres
citydb | objectclass | table | postgres
citydb | opening | table | postgres
但是,目录/data/postgresdb
为空。怎么会这样呢?如果是这样,所有这些表都存储在哪里?
谢谢!