数据库中的位置是存储的postgres表空间的位置

dav*_*100 8 postgresql tablespace postgresql-9.2

我在redhat 6上使用postgres 9.2

这应该很简单但我无法在任何地方找到它.我正在寻找存储postgres表空间位置的数据库表和列,我认为它将在PG_TABLESPACE中,但是

select * from pg_tablespace
Run Code Online (Sandbox Code Playgroud)

显示...

postgres=# select * from pg_tablespace;
     spcname     | spcowner | spcacl | spcoptions
-----------------+----------+--------+------------
 pg_default      |       10 |        |
 pg_global       |       10 |        |
 C_TBL_DB91SABIR |       10 |        |
(3 rows)
Run Code Online (Sandbox Code Playgroud)

但没有位置,任何保留位置的想法?

谢谢

Viv*_* S. 18

使用pg_tablespace_location(tablespace_oid)(PostgreSQL 9.2+)获取文件系统所在的路径tablespace.

你会得到oidtablespacepg_tablespace,所以查询应该是

select spcname
      ,pg_tablespace_location(oid) 
from   pg_tablespace;
Run Code Online (Sandbox Code Playgroud)


JER*_*RRY 7

另一个超级简单的命令来列出所有表空间

\db+

这将非常快速地为您提供所有表空间详细信息