On Thu, Nov 3, 2016 at 10:46 PM, Robert Haas <rh...@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 (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers