mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-21 13:56:59 +08:00
Avoid xid error from age() function when run on Hot Standby
This commit is contained in:
@ -93,7 +93,10 @@ Datum
|
||||
xid_age(PG_FUNCTION_ARGS)
|
||||
{
|
||||
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
|
||||
TransactionId now = GetTopTransactionId();
|
||||
TransactionId now = GetTopTransactionIdIfAny();
|
||||
|
||||
if (!TransactionIdIsValid(now))
|
||||
now = ReadNewTransactionId();
|
||||
|
||||
/* Permanent XIDs are always infinitely old */
|
||||
if (!TransactionIdIsNormal(xid))
|
||||
|
||||
Reference in New Issue
Block a user