Bruce Momjian wrote:
> > > BTW, it is annoying that we can't definitively distinguish "postmaster
> > > is not running" from a connectivity problem, but I can't see a way
> > > around that.
> > 
> > Agreed.  I will research this.
> 
> I have researched this and developed the attached patch.  It implements
> PGping() and PGpingParams() in libpq, and has pg_ctl use it for pg_ctl
> -w server status detection.
> 
> The new output for cases where .pgpass is not allowing for a connection
> is:
> 
>       $ pg_ctl -w -l /dev/null start
>       waiting for server to start.... done
>       server started
>       However, could not connect, perhaps due to invalid authentication or
>       misconfiguration.
> 
> The code basically checks the connection status between PQconnectStart()
> and connectDBComplete() to see if the server is running but we failed to
> connect for some reason.

I have applied this patch, with modified wording of the "cannot connect"
case:

        $ pg_ctl -w -l /dev/null start
        waiting for server to start.... done
        server started
        warning:  could not connect, perhaps due to invalid authentication or
        misconfiguration.

I assume having the warning as the last printed things is appropriate. 
This is my second patch this week that got little feedback --- I am
getting a little spooked.  ;-)

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to