Tatsuo Ishii <t-ishii@sra.co.jp> writes:
>> Trying to connect does seem to be the most reliable way to verify
>> that the postmaster is open for business.
> Agreed.
> Do you think it's a good idea to invent a new command such as
> "pg_ping" or should we add a new option to psql instead?
I'd lean towards a pg_ping (Peter E., any comment here?)
Really we'd need to change the postmaster too, because what we need to
do is send a query "are you ready to accept connections?" that the
postmaster will answer without an authentication exchange. AFAIR this
is *not* immediately evident from the postmaster's current behavior ---
I think it will challenge you for a password even before the startup
subprocess is done.
Or we could invent a status file in $PGDATA that's separate from the
pid interlock file, and have pg_ctl look for that. But I think a
communication protocol might be cleaner.
regards, tom lane