Re: List of hostaddrs not supported

Heikki Linnakangas <hlinnaka@iki.fi>

From: Heikki Linnakangas <hlinnaka@iki.fi>
To: "David G. Johnston" <david.g.johnston@gmail.com>, Robert Haas <robertmhaas@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, "Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>, Mithun Cy <mithun.cy@enterprisedb.com>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-06-09T09:52:02Z
Lists: pgsql-hackers
On 06/08/2017 06:39 PM, David G. Johnston wrote:
> These are already failing so I'd agree that explicit rejection isn't
> necessary - the question seems restricted to usability.  Though I suppose
> we need to consider whether there is any problem with the current setup if
> indeed our intended separator is also an allowable character - i.e., do we
> want to future-proof the syntax by requiring quotes now?

Hmm, there is one problem with our current use of comma as a separator: 
you cannot use a Unix-domain socket directory that has a comma in the 
name, because it's interpreted as multiple hostnames. E.g. this doesn't 
work:

psql "host=/tmp/dir,with,commas"

For hostnames, ports, and network addresses (hostaddr), a comma is not a 
problem, as it's not a valid character in any of those.

I don't know if that was considered when this patch was developed. I 
couldn't find a mention of this in the archives. But in any case, that's 
quite orthogonal to the rest of this thread.

- Heikki



Commits

  1. Fix check for empty hostname.

  2. Allow multiple hostaddrs to go with multiple hostnames.

  3. Silence warning about uninitialized 'ret' variable on some compilers.

  4. Give a better error message on invalid hostaddr option.