Hi Stephen,

Stephen Gildea [2006-03-22 22:39 -0500]:
> When starting the PostgreSQL server (with "pg_ctl start") with a
> specific directory (the -D flag), the "wait" code (triggered with the -w
> option) fails to use the directory to find the Unix socket, and so it
> fails to connect to the newly-started server.

Indeed, good catch. This worked well in Sarge and before, when the
socket directory was basically fixed to /var/run/postgresql, but
with Sid's/Etch's multicluster architecture this becomes relevant.

> To repeat, create a new database and start a server on it:
> 
> /usr/lib/postgresql/bin/initdb -D /some/directory
> Edit /some/directory/postgresql.conf to define unix_socket_directory.
>  (It may be a separate bug that this step is necessary.)

It isn't, since the Debian packaging (specifically postgresql-common)
already provides high-level wrappers around this. See manpages of
pg_createcluster and pg_ctlcluster. pg_ctlcluster does not use
pg_ctl's -w option (since it is not reliable) but instead does the
check itself (with supplying the correct socket directory, BTW).

> The following simple patch passes the Unix socket directory to psql for
> the wait check.
> 
> In PostgreSQL 8, the pg_ctl shell script has been replaced by a C
> program.  I haven't tested it, but from looking at the code in pg_ctl.c,
> I suspect the same bug is present.  Running "start -w" calls
> test_postmaster_connection().  As with the buggy script, that routine
> sets only the port and fails to set the host/directory as well.

I will forward this to upstream. As long as you stick to the Debian
infrastructure, this does not bite you anyway. :)

Thank you for your report, and have a nice day!

Martin

-- 
Martin Pitt        http://www.piware.de
Ubuntu Developer   http://www.ubuntu.com
Debian Developer   http://www.debian.org

In a world without walls and fences, who needs Windows and Gates?

Attachment: signature.asc
Description: Digital signature

Reply via email to