From: | Greg Sabino Mullane <htamfids(at)gmail(dot)com> |
---|---|
To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: display hot standby state in psql prompt |
Date: | 2025-06-26 00:52:06 |
Message-ID: | CAKAnmmLf3Qpv54zM2u5N5XbbGDONtiz3F6yhM142O2mdQ3=f_A@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Jun 25, 2025 at 11:50 AM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
wrote:
> Since I cannot get the value of transaction_read_only via
> PQparameterStatus.
Hmmm... we can at least get default_transaction_read_only. As fe-connect.c
points out:
/*
* "transaction_read_only = on" proves that at least one
* of default_transaction_read_only and in_hot_standby
is
* on, but we don't actually know which. We don't care
* though for the purpose of identifying a read-only
* session, so satisfy the CONNECTION_CHECK_TARGET code
by
* claiming they are both on. On the other hand, if
it's
* a read-write session, they are certainly both off.
*/
Maybe that's good enough? It won't detect people starting a new transaction
and declaring it read-only, but it should be sufficient to warn people when
a connection is starting out in a read-only state. And it will still toggle
auto-magically on promotion.
Cheers,
Greg
--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-06-26 00:52:20 | Re: pg_logical_slot_get_changes waits continously for a partial WAL record spanning across 2 pages |
Previous Message | Peter Geoghegan | 2025-06-26 00:29:12 | Re: Inefficient nbtree behavior with row-comparison quals |