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