I'm getting the following error when trying to initdb with CVS tip. This
is on win XP, though I don't know if it's win32 specific. Also of note,
although it says it's clearing the contents of the directory, in actual
fact it leaves the directory structure in place, thus a subsequent
initdb will not run without a manual clearup.

Regards, Dave.

$ initdb
The files belonging to this database system will be owned by user
"dpage".
This user must also own the server process.

The database cluster will be initialized with locale English_United
Kingdom.1252                    .

fixing permissions on existing directory C:/msys/1.0/local/pgsql/data
... ok
creating directory C:/msys/1.0/local/pgsql/data/global ... ok
creating directory C:/msys/1.0/local/pgsql/data/pg_xlog ... ok
creating directory C:/msys/1.0/local/pgsql/data/pg_clog ... ok
creating directory C:/msys/1.0/local/pgsql/data/base ... ok
creating directory C:/msys/1.0/local/pgsql/data/base/1 ... ok
creating directory C:/msys/1.0/local/pgsql/data/pg_tablespaces ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in C:/msys/1.0/local/pgsql/data/base/1 ...
ERROR:  could not open segment 1 of relation 1663/1/1255 (target block
26189776): No such file or directory
Deleted file - C:\msys\1.0\local\pgsql\data\pg_hba.conf
Deleted file - C:\msys\1.0\local\pgsql\data\pg_ident.conf
Deleted file - C:\msys\1.0\local\pgsql\data\PG_VERSION
Deleted file - C:\msys\1.0\local\pgsql\data\postgresql.conf
Deleted file - C:\msys\1.0\local\pgsql\data\base\1\1255
Deleted file - C:\msys\1.0\local\pgsql\data\global\pg_control
Deleted file - C:\msys\1.0\local\pgsql\data\pg_clog\0000
Deleted file - C:\msys\1.0\local\pgsql\data\pg_xlog\0000000000000000
child process was terminated by signal 1
initdb.exe: failed
initdb.exe: removing contents of data directory
"C:/msys/1.0/local/pgsql/data"
$ 

Fri, 18 Jun 2004 23:21:37 +0100
"Dave Page" <dpage@vale-housing.co.uk>
Cannot initdb in cvs tip
"Dave Page" <dpage@vale-housing.co.uk> writes:
> I'm getting the following error when trying to initdb with CVS tip.

> creating template1 database in C:/msys/1.0/local/pgsql/data/base/1 ...
> ERROR:  could not open segment 1 of relation 1663/1/1255 (target block
> 26189776): No such file or directory

The target block number is obviously broken :-(.  But maybe you have
a build consistency problem --- did you try a make distclean and full
rebuild?

> although it says it's clearing the contents of the directory, in actual
> fact it leaves the directory structure in place, thus a subsequent
> initdb will not run without a manual clearup.

Hm.  The rmtree() function in initdb.c is responsible for this, and
I see it has WIN32-specific behavior, which is evidently wrong.
Can you recommend a fix?

			regards, tom lane

Fri, 18 Jun 2004 19:21:45 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: Cannot initdb in cvs tip 
Tom Lane said:
> "Dave Page" <dpage@vale-housing.co.uk> writes:
>> I'm getting the following error when trying to initdb with CVS tip.
>
>> creating template1 database in C:/msys/1.0/local/pgsql/data/base/1 ...
>> ERROR:  could not open segment 1 of relation 1663/1/1255 (target block
>> 26189776): No such file or directory
>
> The target block number is obviously broken :-(.  But maybe you have a
> build consistency problem --- did you try a make distclean and full
> rebuild?
>
>> although it says it's clearing the contents of the directory, in
>> actual fact it leaves the directory structure in place, thus a
>> subsequent initdb will not run without a manual clearup.
>
> Hm.  The rmtree() function in initdb.c is responsible for this, and I
> see it has WIN32-specific behavior, which is evidently wrong.
> Can you recommend a fix?
>

You can use the builtin one I wrote originally (and tested quite a bit)
that doesn't depend on system() calls ;-)

cheers

andrew



Sat, 19 Jun 2004 00:14:32 -0400 (EDT)
"Andrew Dunstan" <andrew@dunslane.net>
Re: Cannot initdb in cvs tip