Mark default_transaction_read_only as GUC_REPORT.
authorTom Lane
Tue, 2 Mar 2021 18:53:46 +0000 (13:53 -0500)
committerTom Lane
Tue, 2 Mar 2021 18:53:54 +0000 (13:53 -0500)
This allows clients to find out the setting at connection time without
having to expend a query round trip to do so; which is helpful when
trying to identify read/write servers.  (One must also look at
in_hot_standby, but that's already GUC_REPORT, cf bf8a662c9.)
Modifying libpq to make use of this will come soon, but I felt it
cleaner to push the server change separately.

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

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

doc/src/sgml/libpq.sgml
doc/src/sgml/protocol.sgml
src/backend/utils/misc/guc.c

index c635b6570c134c9b67f762783356df3d7ab18752..42b02b0a00c0448c2f9eaacc7f38f0f4f0346e8b 100644 (file)
@@ -2191,6 +2191,7 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName);
        server_encoding,
        client_encoding,
        application_name,
+       default_transaction_read_only,
        in_hot_standby,
        is_superuser,
        session_authorization,
@@ -2206,7 +2207,8 @@ const char *PQparameterStatus(const PGconn *conn, const char *paramName);
        IntervalStyle was not reported by releases before 8.4;
        application_name was not reported by releases before
        9.0;
-       in_hot_standby was not reported by releases before
+       default_transaction_read_only and
+       in_hot_standby were not reported by releases before
        14.)
        Note that
        server_version,
index a51f2c9920b35f0249819c6303451456d46fef0d..43092fe62a61f076bd54e40670be671a7d413b22 100644 (file)
@@ -1278,6 +1278,7 @@ SELCT 1/0;
     server_encoding,
     client_encoding,
     application_name,
+    default_transaction_read_only,
     in_hot_standby,
     is_superuser,
     session_authorization,
@@ -1293,7 +1294,8 @@ SELCT 1/0;
     IntervalStyle was not reported by releases before 8.4;
     application_name was not reported by releases before
     9.0;
-    in_hot_standby was not reported by releases before
+    default_transaction_read_only and
+    in_hot_standby were not reported by releases before
     14.)
     Note that
     server_version,
index d626731723bdc3498241b7bee1b07682c1e07e4c..7167cff7c3397414fdf6f08ffc46e6411f81c6f4 100644 (file)
@@ -1619,7 +1619,8 @@ static struct config_bool ConfigureNamesBool[] =
    {
        {"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
            gettext_noop("Sets the default read-only status of new transactions."),
-           NULL
+           NULL,
+           GUC_REPORT
        },
        &DefaultXactReadOnly,
        false,