Avoid xid error from age() function when run on Hot Standby

This commit is contained in:
Simon Riggs 2012-05-09 13:56:24 +01:00
parent 773b5e0efa
commit 5829387381
1 changed files with 4 additions and 1 deletions

View File

@ -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))