Re: [GENERAL] initdb and "exit_nicely"... - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [GENERAL] initdb and "exit_nicely"...
Date
Msg-id Pine.LNX.4.21.0005181457000.349-200000@localhost.localdomain
Whole thread Raw
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] Question about databases in alternate locations...
Next
From: The Hermit Hacker
Date:
Subject: HEADS UP: CVSROOT location changed ...