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

From Fujii Masao
Subject Re: SQL function which allows to distinguish a server being in point in time recovery mode and an ordinary replica
Date
Msg-id 4dc90367-35b9-4b66-83f9-84c960900c6f@oss.nttdata.com
Whole thread Raw
In response to Re: SQL function which allows to distinguish a server being in point in time recovery mode and an ordinary replica  (m.litsarev@postgrespro.ru)
List pgsql-hackers

On 2025/03/26 5:26, m.litsarev@postgrespro.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




pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: Using read stream in autoprewarm
Next
From: Andres Freund
Date:
Subject: Re: BTScanOpaqueData size slows down tests