Re: initdb in C

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: initdb in C
Date: 2003-11-08 17:10:23
Message-ID: 200311081710.hA8HANm18330@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)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.

Again, this directory recreate happens only on Win32, an I thought it
would be OK there.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-11-08 17:13:52 Re: New approach to ye olde cross-datatype indexing problem
Previous Message Bruce Momjian 2003-11-08 17:09:51 Re: initdb in C

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2003-11-08 17:18:20 Re: initdb in C
Previous Message Bruce Momjian 2003-11-08 17:09:51 Re: initdb in C

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-11-08 17:18:20 Re: initdb in C
Previous Message Bruce Momjian 2003-11-08 17:09:51 Re: initdb in C