Skip to content

Commit 5829387

Browse files
Avoid xid error from age() function when run on Hot Standby
1 parent 773b5e0 commit 5829387

File tree

1 file changed

+4
-1
lines changed
  • src/backend/utils/adt

1 file changed

+4
-1
lines changed

src/backend/utils/adt/xid.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ Datum
9393
xid_age(PG_FUNCTION_ARGS)
9494
{
9595
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
96-
TransactionId now = GetTopTransactionId();
96+
TransactionId now = GetTopTransactionIdIfAny();
97+
98+
if (!TransactionIdIsValid(now))
99+
now = ReadNewTransactionId();
97100

98101
/* Permanent XIDs are always infinitely old */
99102
if (!TransactionIdIsNormal(xid))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy