Re: libpq host/hostaddr/conninfo inconsistencies - Mailing list pgsql-hackers

From Robert Haas
Subject Re: libpq host/hostaddr/conninfo inconsistencies
Date
Msg-id CA+TgmoZKGZEqRj-rrhdPhyTroLK0dkVMr3vJVSkukotv+cvY7g@mail.gmail.com
Whole thread Raw
In response to libpq host/hostaddr/conninfo inconsistencies  (Fabien COELHO <coelho@cri.ensmp.fr>)
Responses Re: libpq host/hostaddr/conninfo inconsistencies  (Fabien COELHO <coelho@cri.ensmp.fr>)
List pgsql-hackers
On Mon, Aug 20, 2018 at 7:32 AM Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>    sh> psql "host=localhost,127.0.0.2,, hostaddr=127.0.0.1,,127.0.0.3,"
>    # attempt 1 is 127.0.0.1 identified as localhost
>    # attempt 2 is 127.0.0.2
>    # attempt 3 is 127.0.0.3 identified as the default, whatever it is
>    # attempt 4 is really the default

I think this patch is a solution in search of a problem.  It's true
that the above example is very confusing, but there's no reason for
everybody to ever do that.  It's like saying that C is a bad
programming language because people can do this:

https://www.ioccc.org/2018/anderson/prog.c

Well, no.  The fact that a programming language -- or a connection
string -- can be used to create incomprehensible constructs is an
artifact of it being powerful and flexible, not a defect.

What users should do is just use host.  If that causes name lookups
they want to avoid, they should instead use both host and hostaddr.
If they do that, they'll be fine.  If they do strange things like
specify host and hostaddr strings that don't match, then yes, it won't
work very well.  But the documentation already says that, so I don't
really see why we need to change anything here.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: PostgreSQL vs SQL/XML Standards
Next
From: Arne Scheffer
Date:
Subject: Re: [PATCH] pg_hba.conf : new auth option : clientcert=verify-full