Re: tablespaces inside $PGDATA considered harmful - Mailing list pgsql-hackers

From Joshua D. Drake
Subject Re: tablespaces inside $PGDATA considered harmful
Date
Msg-id 54CBB4AB.1090805@commandprompt.com
Whole thread Raw
In response to Re: tablespaces inside $PGDATA considered harmful  (Bruce Momjian <bruce@momjian.us>)
Responses Re: tablespaces inside $PGDATA considered harmful
Re: tablespaces inside $PGDATA considered harmful
List pgsql-hackers
On 01/30/2015 08:19 AM, Bruce Momjian wrote:
>
> On Fri, Jan 30, 2015 at 11:12:43AM -0500, Robert Haas wrote:
>> I think everyone who has read this mailing list for a while is
>> probably already aware of this problem.  When you create a tablespace
>> somewhere inside the data directory, weird things happen. If you
>> pg_upgrade and then incautiously run the delete_old_cluster.sh script
>> thus created, you will blow away large chunks of your data.[1]  If you
>
> pg_upgrade doesn't create the deletion script in this case, and warns
> the user:
>
>          Could not create a script to delete the old cluster's data
>          files because user-defined tablespaces exist in the old cluster
>          directory.  The old cluster's contents must be deleted manually.
>
>> In the short term, I favor just adding a warning, so that people get
>> some clue that they are doing something that might be a bad idea.  In
>> the long term, we might want to do more.  Thoughts?
>
> Yes, good idea.

Uhm, wouldn't it be a rather simple patch to say:

if tablespace_create() in $PGDATA:  ERROR!

?

I mean yes a warning is good but it is after the fact, the tablespace is 
already created. We know that tablespaces in $PGDATA are a bad idea, why 
not protect the user?

JD


>


-- 
Command Prompt, Inc. - http://www.commandprompt.com/  503-667-4564
PostgreSQL Support, Training, Professional Services and Development
High Availability, Oracle Conversion, @cmdpromptinc
"If we send our children to Caesar for their education, we should             not be surprised when they come back as
Romans."



pgsql-hackers by date:

Previous
From: Sawada Masahiko
Date:
Subject: Re: Proposal: knowing detail of config files via SQL
Next
From: Robert Haas
Date:
Subject: Re: parallel mode and parallel contexts