Thread: Re: [GENERAL] initdb and "exit_nicely"...

Re: [GENERAL] initdb and "exit_nicely"...

From
Peter Eisentraut
Date:
I wrote:

> Jeffery Collins writes:
> > It seems like it would be a whole lot "nicer" if initdb only deleted
> > the files that it attempted to create OR if the default was not to
> > delete anything.
>
> Okay, I could go for the former. What do others think?

Here's a patch that might do what you need but I'm somewhat suspicious of
this situation. Recycling an old PGDATA directory is not supported, in
facts it's explicitly prevented with certain checks in initdb. So
apparently you precreated the data directory and put "interesting
things" of your own in it, which is not necessarily something that's
encouraged either.

It does make sense to leave the PGDATA directory and only clean out the
_contents_ on failure, that is, use `rm -rf $PGDATA/*' instead of `rm -rf
$PGDATA' but I doubt that that can be done portably.

--
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden

Attachment