Re: -d option for pg_isready is broken

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Fabrízio Mello <fabriziomello(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -d option for pg_isready is broken
Date: 2013-12-19 17:56:53
Message-ID: CAHGQGwGCcWK4dTpRPtVEcJzubVTkArLKLBC7Q=QDNG4PaMxMng@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 12, 2013 at 4:48 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Wed, Dec 11, 2013 at 2:29 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> More generally, if we do go over in 9.4 to the position that PQhost
>>> reports the host parameter and nothing but, I'm not sure that introducing
>>> a third behavior into the back branches is something that anybody will
>>> thank us for.
>
>> It doesn't seem very plausible to say that we're just going to
>> redefine it that way, unless we're planning to bump the soversion.
>
> Well, we didn't bump the soversion (nor touch the documentation)
> in commit f6a756e4, which is basically what I'm suggesting we ought
> to revert. It was nothing but a quick hack at the time, and hindsight
> is saying it was a bad idea. Admittedly, it was long enough ago that
> there might be some grandfather status attached to the current behavior;
> but that argument can't be made for changing its behavior still further.
>
>> But maybe we should decide what we *are* going to do in master first,
>> before deciding what to back-patch.
>
> Right.

I'm thinking to implement PQhostaddr() libpq function which returns the
host address of the connection. Also I'd like to fix the following two bugs
of PQhost(), which I reported upthread.

> (1) PQhost() can return Unix-domain socket directory path even in the
> platform that
> doesn't support Unix-domain socket.
>
> (2) In the platform that doesn't support Unix-domain socket, when
> neither host nor hostaddr
> are specified, the default host 'localhost' is used to connect to
> the server and
> PQhost() must return that, but it doesn't.

Then, we can change \conninfo so that it calls both PQhostaddr() and
PQhost(). If PQhostaddr() returns non-NULL, \conninfo should display
the IP address. Otherwise, \conninfo should display the return value of
PQhost().

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sawada Masahiko 2013-12-19 18:38:42 Re: Logging WAL when updating hintbit
Previous Message Fujii Masao 2013-12-19 17:35:28 Re: ALTER SYSTEM SET command to change postgresql.conf parameters