On Wed, 2006-09-27 at 14:26 -0700, Jeff Davis wrote:
> When I have "unix_socket_directory" set to an alternate value, "pg_ctl -
> D data -w start" times out. If I set it to default, it works fine.
>
> I'm using postgresql 8.1.4 on FreeBSD.
>
> Perhaps pg_ctl is waiting to see the socket file in /tmp/ before
> reporting that postgresql successfully started?
>
I took a look at the source quickly (as usual, the postgres source is so
easy to read I should have looked before I posted) and I found that the
problem seems to be in test_postmaster_connection() in pg_ctl.c.
The function checks for a non-default port, including scanning the
configuration file, but does not look for a non-default socket
directory.
It seems reasonable to add a check to find the real socket directory
before trying the connection.
I have attached a patch. I wrote it very quickly, but it seems to work
as I expect.
Regards,
Jeff Davis