Re: SQL function which allows to distinguish a server being in point in time recovery mode and an ordinary replica

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: m(dot)litsarev(at)postgrespro(dot)ru, vignesh C <vignesh21(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: SQL function which allows to distinguish a server being in point in time recovery mode and an ordinary replica
Date: 2025-04-02 15:57:13
Message-ID: 4dc90367-35b9-4b66-83f9-84c960900c6f@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2025/03/26 5:26, m(dot)litsarev(at)postgrespro(dot)ru wrote:
> Hi!
>
>> I felt you might have missed attaching the test patches added at [1].
> Well, the tests were written for the initial proposal which (after Michael's review and advices) has been fixed and updated. The original tests became not relevant actually. That is why I dropped them.
>
>> This change is not required:
> Placed back the empty line. The v7 patch is attached.

Wouldn't pg_last_wal_receive_lsn() be almost sufficient for the purpose?
It generally returns NULL in archive recovery mode and a valid LSN
in standby mode. While it's not a perfect solution since it may return NULL
in standby mode until the WAL receiver starts, but it should work in most cases.
Thought?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2025-04-02 15:57:18 Re: BTScanOpaqueData size slows down tests
Previous Message Melanie Plageman 2025-04-02 15:54:24 Re: Using read stream in autoprewarm