Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql 表空间在pg_表中显示为null_Postgresql - Fatal编程技术网

Postgresql 表空间在pg_表中显示为null

Postgresql 表空间在pg_表中显示为null,postgresql,Postgresql,我通过显式传递表空间名称创建了表。但是在签入pg_表和其他pg_表时 Create table test1c (Id integer, name varchar(10)) tablespace testts; select * from pg_tables where tablename='test1c'; 它应该显示表空间名称,但将其显示为空默认表空间将不会显示在pg_表中。表空间 包含表的表空间的名称(如果数据库为默认值,则为null) (强调矿山) 如果要查看实际的表空间,需要

我通过显式传递表空间名称创建了表。但是在签入pg_表和其他pg_表时

Create table test1c (Id integer, name varchar(10)) tablespace testts;

select * 
from pg_tables 
where tablename='test1c';

它应该显示表空间名称,但将其显示为空

默认表空间将不会显示在
pg_表中。表空间

包含表的表空间的名称(如果数据库为默认值,则为null

(强调矿山)


如果要查看实际的表空间,需要在查询中包括
pg_database

select t.schemaname, t.tablename, 
       coalesce(t.tablespace, ts.default_tablespace) as tablespace
from pg_tables t
  cross join (
     select ts.spcname as default_tablespace
     from pg_database d
       join pg_tablespace ts on ts.oid = d.dattablespace
      where d.datname = current_database()
   ) ts
where tablename = 'test1c'
  and schemaname = 'public';

testts
可能是数据库的默认表空间吗?是testts是该数据库的默认表空间。