Re: Tablespace column value null on select * from pg_tables - Mailing list pgsql-general

From Thomas Kellerer
Subject Re: Tablespace column value null on select * from pg_tables
Date
Msg-id d509ccd5-d910-4ff4-5205-a20fe43109c6@gmx.net
Whole thread Raw
In response to Tablespace column value null on select * from pg_tables  (Alex Williams <valenceshell@protonmail.com>)
List pgsql-general
Alex Williams schrieb am 15.07.2019 um 20:35:
> But in my case, I have a database that's in a user-defined tablespace
> (data2) and all the tables/indexes there are also in data2 and I want
> to do a select into a table the results of all the tables /
> tablespaces they are in that database...when doing this:
>> SELECT distinct tablespace FROM pg_tables;
>
> I get 2 rows: null and pg_global (I think to expect null for
> pg_default, but if the table is in a user-defined tablespace, should
> we expect it to show it, in my case, data2?)


If data2 is the default tablespace of the database, then this is expected.

The tablespace column is null in pg_tables if the table is located in the
default tablespace of the database.

See here:

https://www.postgresql.org/message-id/flat/15901-e5cfe2dd7298a3a4%40postgresql.org

And the answer on SO:

https://stackoverflow.com/a/56950950

Thomas



pgsql-general by date:

Previous
From: Alex Williams
Date:
Subject: Re: Tablespace column value null on select * from pg_tables
Next
From: Adrian Klaver
Date:
Subject: Re: Tablespace column value null on select * from pg_tables