On Fri, Nov 12, 2010 at 17:47, Bruce Momjian <bruce@momjian.us> wrote:
> Tom Lane wrote:
>> Bruce Momjian <bruce@momjian.us> writes:
>> > Uh, I still cannot reproduce the failure:
>>
>> I would imagine you need -w option on the start. The whole issue
>> here is whether start's wait-for-server-start code works.
>
> Thanks, I am now able to reproduce this. I was able to get this to
> report the .pgpass problem:
>
> $ psql postgres
> psql: FATAL: password authentication failed for user "postgres"
> password retrieved from file "/u/postgres/.pgpass"
>
> $ pg_ctl stop
> waiting for server to shut down.... done
> server stopped
>
> $ pg_ctl -w -l /dev/null start
> waiting for server to start....FATAL: password authentication failed
> for user "postgres"
> password retrieved from file "/u/postgres/.pgpass"
> .FATAL: password authentication failed for user "postgres"
> password retrieved from file "/u/postgres/.pgpass"
> .FATAL: password authentication failed for user "postgres"
> password retrieved from file "/u/postgres/.pgpass"
> .^C
>
> I basically report the connection error string if it starts with "FATAL:".
>
> I originally tried to check for an ERRCODE_INVALID_PASSWORD error field
> (see // comments), but it seems there is no way to access this, i.e.
> PQgetResult(conn) on a connection failure is always NULL.
>
> Anyway, perhaps FATAL is a better test because it will report any major
> failure, not just a .pgpass one.
>
> Patch attached.
Bad Bruce, using C++ comments like that :P And non-context diff ;)
Does this actually solve the *problem*, though? The problem is not
what is reported on stdout/stderr, the problem is that the net result
is that the server is reported as not started (by the service control
manager) when it actually *is* started. In this case, stderr doesn't
even go anywhere. What happens if you *don't* Ctrl-C it?
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/