Re: [WIP] pg_ping utility

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Phil Sorber <phil(at)omniti(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [WIP] pg_ping utility
Date: 2013-01-20 16:38:27
Message-ID: CA+TgmoZvFUBJXTDK0uy-T1fRUXurWichJa_0fekgarbT4hNchQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Jan 20, 2013 at 9:58 AM, Phil Sorber <phil(at)omniti(dot)com> wrote:
> This was done to silence useless error messages in the logs. If you
> attempt to connect as some user that does not exist, or to some
> database that does not exist, it throws an error in the logs, even
> with PQping. You could fix it with env vars, but since the point is to
> change the user/database that we were connecting as, I figured it
> should be consistent with all the other methods to do that.

Uh, OK. Well, in that case, I'm inclined to think that a
documentation mention is in order, and perhaps an update to the
PQpingParams documentation as well. Because that's hardly obvious.
:-(

> I use this to find the defaults if they don't pass anything in, so I
> know what to put in the status message at the end. I could devise my
> own way to come up with those values as I have seen in some other
> code, but I thought it was better to ask libpq directly what defaults
> it was going to use.

Oh, I see. Is it really important to have the host and port in the
output, or should we trim that down to just e.g. "accepting
connections"? It seems useful to have that if a human is looking at
the output, but maybe not if a machine is looking at the output. And
if somebody doesn't want it, getting rid of it with sed or awk is
nontrivial - imagine:

pg_isready -d "/tmp:5432 - accepting connections"

> I had not considered this. I will take a look and provide an updated patch.

Sounds good.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-01-20 16:45:31 Re: Passing connection string to pg_basebackup
Previous Message Stephen Frost 2013-01-20 16:30:01 Re: Thinking about WITH CHECK OPTION for views