pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: libpq: Allow connection strings and URIs to specify multiple hos
2+ messages / 2 participants
[nested] [flat]

* pgsql: libpq: Allow connection strings and URIs to specify multiple hos
@ 2016-11-03 13:46 Robert Haas <rhaas@postgresql.org>
  2016-11-28 07:12 ` Re: [COMMITTERS] pgsql: libpq: Allow connection strings and URIs to specify multiple hos Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Robert Haas @ 2016-11-03 13:46 UTC (permalink / raw)
  To: pgsql-committers

libpq: Allow connection strings and URIs to specify multiple hosts.

It's also possible to specify a separate port for each host.

Previously, we'd loop over every address returned by looking up the
host name; now, we'll try every address for every host name.

Patch by me.  Victor Wagner wrote an earlier patch for this feature,
which I read, but I didn't use any of his code.  Review by Mithun Cy.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/274bb2b3857cc987cfa21d14775cae9b0dababa5

Modified Files
--------------
doc/src/sgml/libpq.sgml           |  38 ++-
src/interfaces/libpq/fe-auth.c    |  28 +-
src/interfaces/libpq/fe-connect.c | 607 ++++++++++++++++++++++++++------------
src/interfaces/libpq/libpq-int.h  |  41 ++-
4 files changed, 506 insertions(+), 208 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: [COMMITTERS] pgsql: libpq: Allow connection strings and URIs to specify multiple hos
  2016-11-03 13:46 pgsql: libpq: Allow connection strings and URIs to specify multiple hos Robert Haas <rhaas@postgresql.org>
@ 2016-11-28 07:12 ` Michael Paquier <michael.paquier@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2016-11-28 07:12 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; +Cc: PostgreSQL mailing lists <pgsql-hackers@postgresql.org>

On Thu, Nov 3, 2016 at 10:46 PM, Robert Haas <rhaas@postgresql.org> wrote:
> libpq: Allow connection strings and URIs to specify multiple hosts.
>
> It's also possible to specify a separate port for each host.
>
> Previously, we'd loop over every address returned by looking up the
> host name; now, we'll try every address for every host name.
>
> Patch by me.  Victor Wagner wrote an earlier patch for this feature,
> which I read, but I didn't use any of his code.  Review by Mithun Cy.

While testing this feature I have bumped into the following restrictions:
$ psql -d "port=5432,5433"
psql: could not match 2 port numbers to 1 hosts
$ psql -d "port=5432,5433 host=/tmp"
psql: could not match 2 port numbers to 1 hosts

However this works:
$ psql -d "port=5432,5433 host=/tmp,/tmp"
psql: could not connect to server: Connection refused
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
could not connect to server: Connection refused
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5433"?

That's really user-unfriendly. Shouldn't libpq try in both cases to
use the single entry provided by the user or the default available? I
would imagine that for most users it would make sense to specify a
single PGHOST but try to different ports, not all users run a single
instance by server (though they should not).

This makes me think that we should have a set of regression tests to
test libpq URIs and connection strings, and the multi-host support in
connection strings gives a stronger reason to have one IMO.
-- 
Michael


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-11-28 07:12 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-11-03 13:46 pgsql: libpq: Allow connection strings and URIs to specify multiple hos Robert Haas <rhaas@postgresql.org>
2016-11-28 07:12 ` Michael Paquier <michael.paquier@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox