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

From Fabien COELHO
Subject Re: libpq host/hostaddr/conninfo inconsistencies
Date
Msg-id alpine.DEB.2.21.1902211527260.27203@lancre
Whole thread Raw
In response to Re: libpq host/hostaddr/conninfo inconsistencies  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: libpq host/hostaddr/conninfo inconsistencies
List pgsql-hackers
Hello Tom,

> My only complaint about this is that it makes it sound like you *must*
> provide "host", even when giving "hostaddr":

That is the idea, "hostaddr" is moslty never needed.

It is the initial misleading issue I've been complaining about: one can 
specify an IP *both* in host (although it is not documented) and in 
hostaddr... and when both are provided, things started being messy: the 
information displayed was plain wrong (eg telling you that you were 
connected to an IP when you were really connected to another), and one 
could not get the actual information about the current connection out of 
libpq.

A committed patch has fixed the display (\conninfo) and connection 
(\c) issues by extending libpq and being carefull about the message 
displayed or the information used to reconnect, which were basically bug 
fixes.

About host/hostaddr, my initial submission was to force "host" as the 
target (whether name, directory, or ip which already work) and "hostaddr" 
only as a lookup shortcut, which is I think its initial intended use. This 
has been rejected.

Now I'm just trying to improve the documentation so that at least it 
reflects what is done, and implicitely advise about how to use the 
features properly even if it is not enforced: Basically, a user should 
always used "host" for all purposes because it works, and that makes one 
parameter for one purpose, and "hostaddr" is only needed for lookup 
shortcut, which is basically a very rare and specialized use case.

-- 
Fabien.


pgsql-hackers by date:

Previous
From: MikalaiKeida@ibagroup.eu
Date:
Subject: RE: Timeout parameters
Next
From: Andreas Karlsson
Date:
Subject: Re: Journal based VACUUM FULL