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

From Tom Lane
Subject Re: libpq host/hostaddr/conninfo inconsistencies
Date
Msg-id 22232.1550764539@sss.pgh.pa.us
Whole thread Raw
In response to Re: 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
Fabien COELHO <coelho@cri.ensmp.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


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: libpq host/hostaddr/conninfo inconsistencies
Next
From: Tom Lane
Date:
Subject: Re: libpq host/hostaddr/conninfo inconsistencies