On Sun, Jan 20, 2013 at 9:58 AM, Phil Sorber <phil@omniti.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