Re: Tablespace column value null on select * from pg_tables

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Tablespace column value null on select * from pg_tables
Date: 2019-07-15 20:26:49
Message-ID: d509ccd5-d910-4ff4-5205-a20fe43109c6@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-07-16 00:33:03 Re: Tablespace column value null on select * from pg_tables
Previous Message Alex Williams 2019-07-15 19:53:43 Re: Tablespace column value null on select * from pg_tables