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 

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 

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

Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to