"Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
> Alvaro Herrera <alvherre@commandprompt.com> wrote:
>> That's within my definition of "ugly", yes :-) My ideal tool would
>> do something like
>>
>> $ pg_ping -h foo -p 5555
>> IN_RECOVERY
>> $ echo $?
>> 2
>>
>> $ # sleep a bit ...
>>
>> $ pg_ping -h foo -p 5555
>> READY
>> $ echo $?
>> 0
> Cool, but how would you do that without bypassing authentication?
The postmaster is already set up so that if it's not accepting
connections, it'll tell you so before getting to the authentication
stage.
If anyone were to go to the trouble of inventing pg_ping, I'd be a bit
inclined to add something to the postmaster protocol so that a ping
packet didn't have to look just like a phony login attempt. But that's
just so that people who log connection attempts won't get all flustered.
The capability exists anyway.
regards, tom lane