Re: fix psql \conninfo & \connect when using hostaddr - Mailing list pgsql-hackers

From Robert Haas
Subject Re: fix psql \conninfo & \connect when using hostaddr
Date
Msg-id CA+TgmobO5U=q4HR_SL3KBwoinbjmktXNyU9XDNfLBmVh7ib69w@mail.gmail.com
Whole thread Raw
In response to fix psql \conninfo & \connect when using hostaddr  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: fix psql \conninfo & \connect when using hostaddr  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On Fri, Oct 26, 2018 at 9:54 AM Fabien COELHO <coelho@cri.ensmp.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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: PostgreSQL Limits and lack of documentation about them.
Next
From: David Rowley
Date:
Subject: Re: Calculate total_table_pages after set_base_rel_sizes()