Commit 58293873 authored by Simon Riggs's avatar Simon Riggs

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

parent 773b5e0e
...@@ -93,7 +93,10 @@ Datum ...@@ -93,7 +93,10 @@ Datum
xid_age(PG_FUNCTION_ARGS) xid_age(PG_FUNCTION_ARGS)
{ {
TransactionId xid = PG_GETARG_TRANSACTIONID(0); TransactionId xid = PG_GETARG_TRANSACTIONID(0);
TransactionId now = GetTopTransactionId(); TransactionId now = GetTopTransactionIdIfAny();
if (!TransactionIdIsValid(now))
now = ReadNewTransactionId();
/* Permanent XIDs are always infinitely old */ /* Permanent XIDs are always infinitely old */
if (!TransactionIdIsNormal(xid)) if (!TransactionIdIsNormal(xid))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment