[HACKERS] List of hostaddrs not supported - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject [HACKERS] List of hostaddrs not supported
Date
Msg-id 10badbc6-4d5a-a769-623a-f7ada43e14dd@iki.fi
Whole thread Raw
Responses Re: [HACKERS] List of hostaddrs not supported  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [HACKERS] List of hostaddrs not supported  (Robert Haas <robertmhaas@gmail.com>)
Re: [HACKERS] List of hostaddrs not supported  (Jeff Janes <jeff.janes@gmail.com>)
List pgsql-hackers
While testing libpq and GSS the other day, I was surprised by the 
behavior of the host and hostaddr libpq options, if you specify a list 
of hostnames.

I did this this, and it took me quite a while to figure out what was 
going on:

> $ psql "dbname=postgres hostaddr=::1  host=localhost,localhost user=krbtestuser" -c "SELECT 'hello'"
> psql: GSSAPI continuation error: Unspecified GSS failure.  Minor code may provide more information
> GSSAPI continuation error: Server postgres/localhost,localhost@PG.EXAMPLE not found in Kerberos database

That was a pilot error; I specified a list of hostnames, but only one 
hostaddr. But I would've expected to get a more helpful error, pointing 
that out.

Some thoughts on this:

1. You cannot actually specify a list of hostaddrs. Trying to do so 
gives error:

> psql: could not translate host name "::1,::1" to address: Name or service not known

That error message is a bit inaccurate, in that it wasn't really a "host 
name" that it tried to translate, but a raw address in string format. 
That's even more confusing if you make the mistake that you specify 
"hostaddr=localhost":

> psql: could not translate host name "localhost" to address: Name or service not known

But in the first case, could we detect that there is a comma in the 
string, and give an error along the lines of "list of hostaddr's not 
supported". (Or better yet, support multiple hostaddrs)

2. The documentation is not very clear on the fact that multiple 
hostaddr's is not supported. Nor what happens if you specify a single 
hostaddr, but a list of hostnames. (The list of hostnames gets treated 
as a single hostname, that's what.)


So, this is all quite confusing. I think we should support a list of 
hostaddrs, to go with the list of hostnames. It seems like a strange 
omission. Looking at the archives, it was mentioned a few times when 
this was developed and reviewed, latest Takayuki Tsunakawa asked [1] the 
same question, but it was then forgotten about.

[1] 
https://www.postgresql.org/message-id/0A3221C70F24FB45833433255569204D1F63FB5E%40G01JPEXMBYT05

- Heikki




pgsql-hackers by date:

Previous
From: Nikitin Nikolay
Date:
Subject: [HACKERS] Long binded parameter value in the postgres log
Next
From: Ashutosh Bapat
Date:
Subject: Re: [HACKERS] Adding support for Default partition in partitioning