Re: initdb in C - Mailing list pgsql-patches

From Tom Lane
Subject Re: initdb in C
Date
Msg-id 12187.1068310263@sss.pgh.pa.us
Whole thread Raw
In response to Re: initdb in C  (Peter Eisentraut <peter_e@gmx.net>)
Responses Re: initdb in C
List pgsql-patches
Peter Eisentraut <peter_e@gmx.net> writes:
> Andrew Dunstan writes:
>> recreating the datadir if we didn't create it initially should be OK in
>> that case, and it makes the code simpler.

> That should be avoided, because you'll have trouble recreating the
> original directory with all its properties such as ownership, permissions,
> etc., at least not without making the code anything but simpler.  There
> might even be a situation were you are allowed to delete the directory but
> cannot create a new one.

Consider also the strong likelihood that the data directory's parent
directory is owned by root, so that you do not have the ability to
delete and recreate the data directory because you don't have write
permission on its parent.  The main reason initdb is set up to be able
to start with an existing-but-empty data dir is exactly because creating
that directory may have required permissions that initdb itself hasn't
got.

            regards, tom lane

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: initdb in C
Next
From: Andrew Dunstan
Date:
Subject: Re: [pgsql-hackers-win32] initdb in C