>> pg_is_in_recovery() returns a bool, are you proposing to change that?
>
> No. I just thought about adding more condition when it returns true.
Here is the patch. Comments are welcome!
*** a/src/backend/access/transam/xlog.c
--- b/src/backend/access/transam/xlog.c
***************
*** 5604,5610 **** GetLatestXTime(void)
Datum
pg_is_in_recovery(PG_FUNCTION_ARGS)
{
! PG_RETURN_BOOL(RecoveryInProgress());
}
/*
--- 5604,5613 ----
Datum
pg_is_in_recovery(PG_FUNCTION_ARGS)
{
! /* use volatile pointer to prevent code rearrangement */
! volatile WalRcvData *walrcv = WalRcv;
!
! PG_RETURN_BOOL(RecoveryInProgress() && walrcv->walRcvState == WALRCV_RUNNING);
}
/*