Re: [WIP] pg_ping utility

From: Phil Sorber <phil(at)omniti(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, Thom Brown <thom(at)linux(dot)com>
Subject: Re: [WIP] pg_ping utility
Date: 2012-10-15 21:40:15
Message-ID: CADAkt-jhv5ZT4tpM+JMfKjY39R_2jgQydivdcmYuzWC9mQLHcg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Oct 15, 2012 at 5:32 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On Monday, October 15, 2012 11:28:36 PM Thom Brown wrote:
>> On 13 October 2012 22:19, Phil Sorber <phil(at)omniti(dot)com> wrote:
>> > Based on a previous thread
>> > (http://archives.postgresql.org/pgsql-hackers/2012-10/msg00131.php) I
>> > have put together a first attempt of a pg_ping utility. I am attaching
>> > two patches. One for the executable and one for the docs.
>> >
>> > I would also like to make a regression tests and translations, but
>> > wanted to get feedback on what I had so far.
>>
>> pg_pong:
>>
>> 1 packets transmitted, 1 received, 0% packet loss, time 2 days
>>
>> Well this works for me, and I raised a couple typos directly to Phil.
>> The advantage of this over "pg_ctl status" is that it doesn't have to
>> be run on the machine local to the database, and access to the data
>> directory isn't required if it is run locally. The advantage over
>> connecting using a regular connection is that authentication and
>> authorisation isn't necessary, and if all connections are in use, it
>> will still return the desired result. And it does what it says on the
>> tin.
>>
>> So +1 from me.
>
> Why not add a pg_ctl subcommand for that? For me that sounds like a good place
> for it...
>
> Andres
> --
> Andres Freund http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services

We discussed that in the other thread. pg_ctl is often only (always?)
packaged with the server binaries and not client. Discussed adding it
to psql, but Tom said he'd prefer to see it as a standalone binary
anyway. I don't have any real strong opinion about it going into an
existing binary like psql (I have a patch for this too) or being
standalone, I just think we should have some way to do this from the
command line on a client. It seems trivial, but I think it's very
useful and if our libpq already supports this, why not?

FWIW pg_ctl does use the same API (PQping), but it doesn't expose it
as an option you can use exclusively. It just uses it to make sure the
server is up/down depending on what it is trying to do.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2012-10-15 21:59:10 Re: proposal - assign result of query to psql variable
Previous Message Simon Riggs 2012-10-15 21:33:49 Global Sequences