Postgresql 其中,数据库中是存储的postgres表空间的位置
我正在redhat 6上使用postgres 9.2 这应该很简单,但我在任何地方都找不到。我正在寻找存储postgres表空间位置的数据库表和列,我以为它会在PG_表空间中,但是Postgresql 其中,数据库中是存储的postgres表空间的位置,postgresql,postgresql-9.2,tablespace,Postgresql,Postgresql 9.2,Tablespace,我正在redhat 6上使用postgres 9.2 这应该很简单,但我在任何地方都找不到。我正在寻找存储postgres表空间位置的数据库表和列,我以为它会在PG_表空间中,但是 select * from pg_tablespace 显示 postgres=# select * from pg_tablespace; spcname | spcowner | spcacl | spcoptions -----------------+----------+--------
select * from pg_tablespace
显示
postgres=# select * from pg_tablespace;
spcname | spcowner | spcacl | spcoptions
-----------------+----------+--------+------------
pg_default | 10 | |
pg_global | 10 | |
C_TBL_DB91SABIR | 10 | |
(3 rows)
但是没有位置,知道位置在哪里吗
感谢使用(PostgreSQL 9.2+)获取表空间所在文件系统中的路径
您将从pg_tablespace
中获得oid
oftablespace
,因此查询应该是
select spcname
,pg_tablespace_location(oid)
from pg_tablespace;
使用下面的查询获取表空间名称表空间位置
postgres=# select spcname ,pg_tablespace_location(oid) from pg_tablespace;
spcname | pg_tablespace_location
------------+-------------------------------
pg_default |
pg_global |
fastspace | /var/lib/postgresql/data/base
demotbs | /var/lib/postgresql/data
答案不准确:显示数据\u目录
将向您显示当前DBhi@wingedparter的位置,该位置显示PGDATA位置,但我正在查找表空间的目录,我想查询它,以便在删除表空间时可以编写删除物理文件夹的脚本。请尝试此从pg_表空间中选择spcname,pg_表空间_位置(oid)代码>复制已经存在的公认答案有什么意义?