List of hostaddrs not supported

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: List of hostaddrs not supported
Date: 2017-06-08 08:36:38
Message-ID: 10badbc6-4d5a-a769-623a-f7ada43e14dd@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)PG(dot)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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2017-06-08 09:24:33 Re: Adding support for Default partition in partitioning
Previous Message Nikitin Nikolay 2017-06-08 08:00:09 Long binded parameter value in the postgres log