| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
| Cc: | Fujii Masao <masao(dot)fujii(at)gmail(dot)com>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: display hot standby state in psql prompt |
| Date: | 2025-10-28 16:42:52 |
| Message-ID: | aQDyjGLkBN-Oowty@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Oct 28, 2025 at 12:03:48PM +0100, Jim Jones wrote:
> On 28/10/2025 00:55, Fujii Masao wrote:
>> If we mark transaction_read_only as GUC_REPORT, wouldn't the reset value
>> be sent automatically at the end of the transaction? It seems like we wouldn't
>> need any new mechanism for that. However, the downside might be that
>> more ParameterStatus messages would be sent, potentially adding overhead.
>
> I tried that, but simply marking it as GUC_REPORT does not reset the
> variable when the transaction ends.
IIUC the problem is that we use GUC_ACTION_SET for those even though they
are reset at transaction end by the routines in xact.c. Something like the
following seems to be enough to get it working as expected in some basic
tests, but there are probably other things to consider. Keep in mind that
previous proposals to mark transaction_read_only as GUC_REPORT have been
rejected, too.
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index a82286cc98a..d0bbb5aff19 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -3349,6 +3349,12 @@ set_config_with_handle(const char *name, config_handle *handle,
bool prohibitValueChange = false;
bool makeDefault;
+ if (action == GUC_ACTION_SET &&
+ (strcmp(name, "transaction_isolation") == 0 ||
+ strcmp(name, "transaction_read_only") == 0 ||
+ strcmp(name, "transaction_deferrable") == 0))
+ action = GUC_ACTION_LOCAL;
+
if (elevel == 0)
{
if (source == PGC_S_DEFAULT || source == PGC_S_FILE)
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nico Williams | 2025-10-28 16:46:46 | Re: Channel binding for post-quantum cryptography |
| Previous Message | Dagfinn Ilmari Mannsåker | 2025-10-28 16:41:37 | Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions |