Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> 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?
>
> It'd be a bit of a pain but I can see the problem. You certainly
> shouldn't delete the $PGDATA directory itself unless you created it,
> IMHO. Doing more than that would imply that initdb's cleanup
> function would have to know the list of files/subdirectories that
> normally get created during initdb, so as to remove only those and
> not anything else that might be lying around in the directory.
> That'd be a considerable maintenance headache since most of said files
> are not created directly by the script...
>
I agree this would be a pain. After thinking about it, I think the best
approach is to do one or both of the following:
- Change the default to not delete $PGDATA.
- Prompt the user for confirmation before deleting $PGDATA.
Anything else sounds like a pain in the *ss and very error prone.
Jeff Collins