From: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
---|---|
To: | Robert Haas <rhaas(at)postgresql(dot)org> |
Cc: | PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [COMMITTERS] pgsql: libpq: Allow connection strings and URIs to specify multiple hos |
Date: | 2016-11-28 07:12:05 |
Message-ID: | CAB7nPqRuLH6YFrKWygLRLO=Fb6gznAHHzTH68ZtC51vtD6HM=w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
On Thu, Nov 3, 2016 at 10:46 PM, Robert Haas <rhaas(at)postgresql(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-11-28 16:51:40 | pgsql: Fix busted tab-completion pattern for ALTER TABLE t ALTER c DROP |
Previous Message | Tom Lane | 2016-11-28 02:23:45 | pgsql: Code review for early drop of orphaned temp relations in autovac |
From | Date | Subject | |
---|---|---|---|
Next Message | Pavel Stehule | 2016-11-28 07:42:40 | Re: proposal: session server side variables |
Previous Message | Thomas Munro | 2016-11-28 06:28:59 | HASH_CHUNK_SIZE vs malloc rounding |