Hello, I found a problem with libpq connection failover. When libpq cannot connect to earlier hosts in the host list, it doesn't try to connect to other hosts. For example, when you specify a wrong port that some non-postgres program is using, or some non-postgres program is using PG's port unexpectedly, you get an error like this:
$ psql -h localhost -p 23 psql: received invalid response to SSL negotiation: $ psql -h localhost -p 23 -d "sslmode=disable" psql: expected authentication request from server, but received Likewise, when the first host has already reached max_connections, libpq doesn't attempt the connection aginst later hosts. The attached patch fixes this. I'll add this item in the PostgreSQL 10 Open Items. Regards Takayuki Tsunakawa
libpq-reconnect-on-error.patch
Description: libpq-reconnect-on-error.patch
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers