Seamless Application Failover using libpq

29 views
Skip to first unread message

f.holop

unread,
Apr 24, 2020, 10:39:41 AM4/24/20
to django-d...@googlegroups.com
hello,

i was wondering if there was any work done/planned/discussed about
implementing support for this really useful feature of libpq:

$ psql 'postgres://host1:5432,host2:5432,host3:5432/postgres?target_session_attrs=read-write'

Psycopg claims to support all dsn parameters.


https://paquier.xyz/postgresql-2/postgres-10-libpq-read-write/


https://www.postgresql.org/docs/12/libpq-connect.html

target_session_attrs

If this parameter is set to read-write, only a connection in which
read-write transactions are accepted by default is considered
acceptable. The query SHOW transaction_read_only will be sent upon
any successful connection; if it returns on, the connection will be
closed. If multiple hosts were specified in the connection string,
any remaining servers will be tried just as if the connection
attempt had failed. The default value of this parameter, any,
regards all connections as acceptable.



this has the potential of making failover possible without any
additional software.

a quick search through the tickets and PRs brought up no results.

-f
--
Reply all
Reply to author
Forward
0 new messages