| From: | Haribabu Kommi <kommi(dot)haribabu(at)gmail(dot)com> |
|---|---|
| To: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
| Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Enhance pg_stat_wal_receiver view to display connected host |
| Date: | 2018-01-10 05:10:35 |
| Message-ID: | CAJrrPGdTn_9Q3zmTE+7T_ndh0pXj6qB61d5_iSfX7VY9C2+vaQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Jan 9, 2018 at 12:15 PM, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
wrote:
> On Fri, Jan 05, 2018 at 09:15:36AM -0300, Alvaro Herrera wrote:
> > Haribabu Kommi wrote:
> >
> > > And also not returning "default host" details, because for the conninfo
> > > without any host details, the return value must be NULL. But this
> change
> > > may break the backward compatibility of the function.
> >
> > I wouldn't want to have to fight that battle.
>
> Hm. Any users of psql's PROMPT would be equally confused, and this can
> actually lead to more confusion from the user prospective I think than
> just pg_stat_wal_receiver. If you take the case of Haribabu from
> upthread with say this bit in psqlrc:
> \set PROMPT1 '[host=%M;port=%>]=%# '
>
> Then you get on HEAD the following set of results using different
> connection strings:
> 1) host=localhost,localhost hostaddr=127.0.0.1,127.0.0.1 port=5432,5433
> [host=localhost,localhost;port=5432]=#
>
> 2) host=localhost,localhost port=5432,5433
> [host=localhost;port=5432]=#
>
> 3) hostaddr=127.0.0.1,127.0.0.1 port=5432,5433
> [host=[local];port=5432]=#
>
> 4) host=/tmp,tmp hostaddr=127.0.0.1,127.0.0.1
> [host=[local:/tmp,tmp];port=5432]=#
>
> So for cases 2) and 4), mixing both hostaddr and host is hurting the
> experience. The documentation in [1] also specifies that if both host
> and hostaddrs are specified then host is ignored. The same rule applies
> for multiple values so for 2) and 4) the correct values ought to be
> "local" for both of them. This would be more consistent with the pre-9.6
> behavior as well.
>
I think you mean to say for the cases 1) and 4)? because those are the
cases where it differs with pre-9.6 behavior. With the attached patch
of changing PQhost() to return the host if exists, irrespective of the
connection type will bring back the pre-9.6 behavior.
1) host=localhost,localhost hostaddr=127.0.0.1,127.0.0.1 port=5432,5433
[host=localhost;port=5432]=#
4) host=/tmp,tmp hostaddr=127.0.0.1,127.0.0.1
[host=[local];port=5432]=#
Even for default unix domain socket connection,
conn->connhost[conn->whichhost].host
is filled with the details, but not the global member. So no need of
checking global member and returning the same in PQhost() function.
Regards,
Hari Babu
Fujitsu Australia
| Attachment | Content-Type | Size |
|---|---|---|
| PQhost-update-to-return-proper-host-details.patch | application/octet-stream | 1.3 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Edmund Horner | 2018-01-10 05:38:57 | Re: [HACKERS] PATCH: psql tab completion for SELECT |
| Previous Message | Jeff Davis | 2018-01-10 04:24:48 | Re: Rangejoin rebased |