Re: display hot standby state in psql prompt

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: 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-24 15:21:28
Message-ID: CAHGQGwHnx96uspkmOsrpytew0A25wm4ozpe2=GzZpHoAph+t0g@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 23, 2025 at 5:04 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
> v3 attached.

+ const char *hs = PQparameterStatus(pset.db, "in_hot_standby");
+ const char *ro = PQparameterStatus(pset.db, "default_transaction_read_only");

When either hs or ro is NULL, the displayed status can be incorrect.
For example, connecting to a standby server running PostgreSQL 10
incorrectly shows "read/write". In such cases, wouldn't it be clearer
to display something like "unknown", similar to how the "Hot Standby"
column in \conninfo reports "unknown"?

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-10-24 15:22:04 Re: Logical Replication of sequences
Previous Message Srinath Reddy Sadipiralla 2025-10-24 15:13:20 Re: display hot standby state in psql prompt