pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Extend the abilities of libpq's target_session_attrs parameter.
Date: Wed, 03 Mar 2021 01:17:57 +0000
Message-ID: <E1lHG9F-0001UG-Lz@gemulon.postgresql.org> (raw)

Extend the abilities of libpq's target_session_attrs parameter.

In addition to the existing options of "any" and "read-write", we
now support "read-only", "primary", "standby", and "prefer-standby".
"read-write" retains its previous meaning of "transactions are
read-write by default", and "read-only" inverts that.  The other
three modes test specifically for hot-standby status, which is not
quite the same thing.  (Setting default_transaction_read_only on
a primary server renders it read-only to this logic, but not a
standby.)

Furthermore, if talking to a v14 or later server, no extra network
round trip is needed to detect the session's status; the GUC_REPORT
variables delivered by the server are enough.  When talking to an
older server, a SHOW or SELECT query is issued to detect session
read-only-ness or server hot-standby state, as needed.

Haribabu Kommi, Greg Nancarrow, Vignesh C, Tom Lane; reviewed at
various times by Laurenz Albe, Takayuki Tsunakawa, Peter Smith.

Discussion: https://postgr.es/m/CAF3+xM+8-ztOkaV9gHiJ3wfgENTq97QcjXQt+rbFQ6F7oNzt9A@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ee28cacf619f4d9c23af5a80e1171a5adae97381

Modified Files
--------------
doc/src/sgml/libpq.sgml               |  79 ++++++--
src/interfaces/libpq/fe-connect.c     | 352 ++++++++++++++++++++++++++--------
src/interfaces/libpq/fe-exec.c        |  21 +-
src/interfaces/libpq/libpq-fe.h       |   9 +-
src/interfaces/libpq/libpq-int.h      |  27 ++-
src/test/recovery/t/001_stream_rep.pl |  82 +++++++-
6 files changed, 456 insertions(+), 114 deletions(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1lHG9F-0001UG-Lz@gemulon.postgresql.org>
Permalink:  ../E1lHG9F-0001UG-Lz@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1lHG9F-0001UG-Lz@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Extend the abilities of libpq's target_session_attrs parameter.
  In-Reply-To: <E1lHG9F-0001UG-Lz@gemulon.postgresql.org>
  References: <E1lHG9F-0001UG-Lz@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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