Re: libpq host/hostaddr/conninfo inconsistencies

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>
Subject: Re: libpq host/hostaddr/conninfo inconsistencies
Date: 2018-10-25 14:02:39
Message-ID: CA+TgmoZKGZEqRj-rrhdPhyTroLK0dkVMr3vJVSkukotv+cvY7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 20, 2018 at 7:32 AM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arne Scheffer 2018-10-25 14:30:58 Re: [PATCH] pg_hba.conf : new auth option : clientcert=verify-full
Previous Message Alvaro Herrera 2018-10-25 13:56:18 Re: PostgreSQL vs SQL/XML Standards