Re: libpq host/hostaddr/conninfo inconsistencies

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: libpq host/hostaddr/conninfo inconsistencies
Date: 2019-02-21 15:55:39
Message-ID: 22232.1550764539@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> writes:
> However, it does not discuss that an IP can (and should, IMHO) be given
> through "host" if the point is to specify the target by its IP rather than
> a lookup shortcut.

Ah, that's the crux of the problem. There are two ways that you could
consider to be "best practice" for use of these parameters. The one
that is currently documented is:

1. If you want to give a host name, put it in "host".
2. If you want to give a host IP address (to skip DNS), put it in
"hostaddr".
3. ... unless your security arrangements require specifying a host name,
in which case provide the host IP address in "hostaddr" and
the host name in "host".

What Fabien is basically proposing is replacing rule 2 with

2. If you want to give a host IP address (to skip DNS), put it in
"host".

While that would perhaps be an equally good best practice if we'd
started there, it's not clear to me that it has any advantage that
would justify changing the recommendation. In particular, the
existing rule is a lot clearer from a data-type standpoint: host
is for names, hostaddr is for IP addresses.

In any case, the existing doco never comes out and states either
rule set in so many words. Maybe it should.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-02-21 15:57:32 Re: libpq host/hostaddr/conninfo inconsistencies
Previous Message Robert Haas 2019-02-21 15:52:51 Re: libpq host/hostaddr/conninfo inconsistencies