From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: mahadevan@rapidloop.com
Subject: BUG #19047: pg_last_wal_replay_lsn() returns non-NULL after pg_promote()
Date: Thu, 11 Sep 2025 07:09:36 +0000
Message-ID: <19047-0494c16d796fea52@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 19047
Logged by: Mahadevan Ramachandran
Email address: mahadevan@rapidloop.com
PostgreSQL version: 17.6
Operating system: Debian 12, amd64
Description:
After promoting a standby to a primary using pg_promote(), it is expected
that the server is not a primary and does not / cannot replay WALs, and
therefore pg_last_wal_replay_lsn() should return NULL. However, it does not.
To reproduce, setup a primary and a standby, and run the following commands
on the standby:
$ psql -h /tmp -p 8001 postgres
Null display is "~".
psql (17.6 (Debian 17.6-1.pgdg12+1))
Type "help" for help.
postgres=# select pg_last_wal_replay_lsn ();
pg_last_wal_replay_lsn
------------------------
0/40434E0
(1 row)
postgres=# select pg_promote();
pg_promote
------------
t
(1 row)
postgres=# select pg_last_wal_replay_lsn ();
pg_last_wal_replay_lsn
------------------------
0/40434E0
(1 row)
postgres=# select pg_is_in_recovery();
pg_is_in_recovery
-------------------
f
(1 row)
At this point, the server is a primary, but still reports
pg_last_wal_replay_lsn() as non-NULL.
We're reporting this from a real customer issue on the field.
Best,
-Mahadevan
(pgDash - https://pgdash.io)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, mahadevan@rapidloop.com
Subject: Re: BUG #19047: pg_last_wal_replay_lsn() returns non-NULL after pg_promote()
In-Reply-To: <19047-0494c16d796fea52@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox