Re: display hot standby state in psql prompt - Mailing list pgsql-hackers

From Nathan Bossart
Subject Re: display hot standby state in psql prompt
Date
Msg-id aP-ccJv1iyOmrieo@nathan
Whole thread Raw
In response to Re: display hot standby state in psql prompt  (Jim Jones <jim.jones@uni-muenster.de>)
Responses Re: display hot standby state in psql prompt
List pgsql-hackers
On Mon, Oct 27, 2025 at 09:08:17AM +0100, Jim Jones wrote:
> +            Displays the session's read-only status as <literal>read-only</literal>
> +            if the server is in hot standby (<literal>in_hot_standby</literal> is
> +            <literal>on</literal>) or the default transaction mode is read-only
> +            (<literal>default_transaction_read_only</literal> is <literal>on</literal>),
> +            or <literal>read-write</literal> otherwise. Useful for identifying
> +            sessions that cannot perform writes, such as in replication setups.

This was briefly mentioned upthread, but I'm a little concerned that this
doesn't respond to commands like SET TRANSACTION READ ONLY.  I wonder if we
should mark transaction_read_only as GUC_REPORT and use that instead.  FWIW
I see that we marked search_path as GUC_REPORT somewhat recently (see
commit 28a1121).

-- 
nathan



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Batching in executor
Next
From: Mark Wong
Date:
Subject: Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement