initdb in C

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL Win32 port list <pgsql-hackers-win32(at)postgresql(dot)org>, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: initdb in C
Date: 2003-11-08 05:15:42
Message-ID: 200311080515.hA85FgT21744@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-hackers-win32 pgsql-patches

Andrew Dunstan wrote:
>
> Bruce,
>
> I think this is now ready to import into the WIN32 branch. I have ironed out
> the cygwin dependencies, and posted a note about what we'll need to do
> inside postgres to handle the environment values for setlocale() on Windows.
>
> If you want to rip out the unlink stuff (see previous email thread) we'll
> need a version of dirmod.c that is compiled with -DFRONTEND - I guess libpq
> is the obvious place for that.
>
> Apart from initdb.c we'll need the file system_views.sql, which can be taken
> without change (unless someone want to add comments to it), and Makefile
> modifications (see my Makefile on the web for an example, but it probably
> doesn't comply with our standard way of doing things).
>
> Anything broken can then be fixed with patches - I have about 7 versions on
> 5 machines now and my head is starting to swim -).
>
> pg_id and pg_encoding now become redundant in their entirety, as does
> initdb.sh.

Here is a slightly modified version of Andrew's great work in making a C
version of initdb. Other than minor cleanups, the only big change was
to remove rmdir handling because we using rm -r and rmdir /s in
commands/dbcommands.c, so we might as use the same thing for initdb.c
rather than having code that traverses the directory tree doing 'rm'.

The other change was to remove the unlink code and instead use
port/dirmod.c's version.

It passes all the regression tests. I have also included a diff against
Andrew's version so you can see my changes. It seems Andrew had a very
current version of initdb. The only update he missed was the change to
test the number of connections before shared buffers --- I made that
change myself.

I would like to apply this in the next few days to HEAD before initdb.sh
drifts. We are no longer using the WIN32_DEV branch because all our
work is now in 7.5 head.

--
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

Attachment Content-Type Size
unknown_filename text/plain 49.0 KB
unknown_filename text/plain 9.7 KB
unknown_filename text/plain 1.8 KB
unknown_filename text/plain 23.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-11-08 05:31:43 Re: Making PostgreSQL 7.4 (CVS) work properly on OS X 10.3 (7B85)
Previous Message Tom Lane 2003-11-08 04:36:25 Re: bugzilla (Was: What do you want me to do?)

Browse pgsql-hackers-win32 by date

  From Date Subject
Next Message Tom Lane 2003-11-08 05:42:36 Re: [PATCHES] initdb in C
Previous Message Andrew Dunstan 2003-11-07 18:11:18 Re: Committing Resources to Win32

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-11-08 05:42:36 Re: [PATCHES] initdb in C
Previous Message Christopher Kings-Lynne 2003-11-08 02:37:47 FAQ_MSWIN update