Re: [WIP] pg_ping utility

Поиск
Список
Период
Сортировка
От Phil Sorber
Тема Re: [WIP] pg_ping utility
Дата
Msg-id CADAkt-gOdZ1F6PEf2547b9mbv_5Xr759r1O0cCjMBBY=mTxLSg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [WIP] pg_ping utility  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [WIP] pg_ping utility  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Sun, Jan 20, 2013 at 11:38 AM, Robert Haas <robertmhaas@gmail.com> wrote:
> 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.
> :-(
>

Ok. I can add something to the notes section of the docs. I can also
add some code comments for this and for grabbing the default params.

>> 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"
>

If you are scripting I'd assume you would use the return code value.
It might be reasonable to make adding the host and port the verbose
method and have just "accepting connections" as the default output,
but my concern there is a misdiagnosis because someone doesn't realize
what server they are connecting to. This way they can't miss it and
they don't have to add another command line option to get that output.

The other thing I thought about when you mentioned this is not doing
the default lookups if it's in quiet mode. I could move things around
to accomplish this, but not sure it is worth the effort and
complexity. Thoughts?

>> 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: CF3+4 (was Re: Parallel query execution)
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: fix corner use case of variadic fuctions usage