Re: Tablespace column value null on select * from pg_tables

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Tablespace column value null on select * from pg_tables
Date: 2019-07-28 20:45:42
Message-ID: d53b3e96-9005-57dc-dc49-439c1b9d72f0@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 7/28/19 1:24 PM, Peter J. Holzer wrote:
> On 2019-07-16 19:20:24 +0000, Alex Williams wrote:
>> 1. postgres=# ALTER DATABASE mydatabase SET TABLESPACE pg_default;
>>
>> ERROR: some relations of database "mydatabase" are already in tablespace "pg_default"
>>
>> HINT: You must move them back to the database's default tablespace before using this command.
>
> What's the reason for this error? Wouldn't it be simpler to leave
> relations alone which are already in the correct tablespace?

~/src/backend/commands/dbcommands.c

/*
* Check for existence of files in the target directory, i.e., objects of
* this database that are already in the target tablespace. We can't
* allow the move in such a case, because we would need to change those
* relations' pg_class.reltablespace entries to zero, and we don't have
* access to the DB's pg_class to do so.
*/

>
> hp
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sonam Sharma 2019-07-29 12:22:25 Error
Previous Message Tom Lane 2019-07-28 20:43:53 Re: Tablespace column value null on select * from pg_tables