Re: fix psql \conninfo & \connect when using hostaddr

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Artur Zakirov <a(dot)zakirov(at)postgrespro(dot)ru>
Subject: Re: fix psql \conninfo & \connect when using hostaddr
Date: 2018-11-07 21:06:45
Message-ID: CA+TgmobO5U=q4HR_SL3KBwoinbjmktXNyU9XDNfLBmVh7ib69w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 26, 2018 at 9:54 AM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> About updating psql's behavior, without this patch:
>
> sh> psql "host=foo hostaddr=127.0.0.1"
>
> psql> \conninfo
> You are connected to database "fabien" as user "fabien" on host "foo" at port "5432".
> # NOPE, I'm really connected to localhost, foo does not even exist
> # Other apparent inconsistencies are possible when hostaddr overrides
> # "host" which is an socket directory or an IP.

I remain of the opinion that this is not a bug. You told it that foo
has address 127.0.0.1 and it believed you; that's YOUR fault.

> After the patch:
>
> sh> psql "host=foo hostaddr=127.0.0.1"
>
> psql> \conninfo
> You are connected to database "fabien" as user "fabien" on host "foo" (address "127.0.0.1") at port "5432".
> # better

Nevertheless, that seems like a reasonable change to the output. Will
your patch show the IP address in all cases or only when hostaddr is
specified?

--
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 David Rowley 2018-11-07 21:34:57 Re: Calculate total_table_pages after set_base_rel_sizes()
Previous Message Robert Haas 2018-11-07 21:02:56 Re: PostgreSQL Limits and lack of documentation about them.