From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
---|---|
To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
Cc: | 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-07-23 07:03:02 |
Message-ID: | CAFC+b6oEYiW4Nh7vVWyYi5n6g1ac2=E71JP5NaoT2ARjzsTR6g@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Jim,
On Tue, Jul 22, 2025 at 4:40 PM Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> wrote:
> Hi
>
> On 21.07.25 21:12, Greg Sabino Mullane wrote:
> > Seems good enough for me. I think as long as we document it well, it's
> > only going to be a net positive, even with some edge cases.
>
> I just moved the patch from PG19-Drafts to PG19-2 commitfest.[1]
>
> Thanks a lot for the feedback!
>
> Best regards, Jim
>
> 1 - https://commitfest.postgresql.org/patch/5872/
+1 for the patch,i have reviewed and tested this patch, except these below
cosmetic changes it LGTM.
cosmetic changes:
1) add comment about %i in get_prompt api.
2) maybe we can use read-write instead of read/write to be consistent with
the
naming such as options of target_session_attrs uses read-write.
testing:
=> in primary node:
psql (19devel)
Type "help" for help.
postgres=# \set PROMPT1 '[%i] # '
[read/write] # set default_transaction_read_only=on;
SET
[read-only] # set default_transaction_read_only=off;
SET
[read/write] # show in_hot_standby ;
in_hot_standby
----------------
off
(1 row)
[read/write] # set default_transaction_read_only=on;
SET
[read-only] # show in_hot_standby ;
in_hot_standby
----------------
off
(1 row)
[read-only] # \q
=> in replica node
psql (19devel)
Type "help" for help.
postgres=# \set PROMPT1 '[%i] # '
[read-only] # show in_hot_standby ;
in_hot_standby
----------------
on
(1 row)
[read-only] # show default_transaction_read_only;
default_transaction_read_only
-------------------------------
off
(1 row)
[read-only] # set default_transaction_read_only=on;
SET
[read-only] # set transaction_read_only=on;
SET
[read-only] # set transaction_read_only=off;
ERROR: cannot set transaction read-write mode during recovery
[read-only] # select pg_promote();
pg_promote
------------
t
(1 row)
[read-only] # show in_hot_standby ;
in_hot_standby
----------------
off
(1 row)
[read-only] # show default_transaction_read_only;
default_transaction_read_only
-------------------------------
on
(1 row)
[read-only] # set default_transaction_read_only=off;
SET
[read/write] #
--
Thanks,
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-07-23 07:03:29 | Re: recoveryStopsAfter is not usable when recovery_target_inclusive is false |
Previous Message | Andrei Lepikhov | 2025-07-23 07:00:44 | Re: Add estimated hit ratio to Memoize in EXPLAIN to explain cost adjustment |