projects
/
postgresql.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
14c412d
)
Avoid xid error from age() function when run on Hot Standby
author
Simon Riggs
<simon@2ndQuadrant.com>
Wed, 9 May 2012 13:00:09 +0000
(14:00 +0100)
committer
Simon Riggs
<simon@2ndQuadrant.com>
Wed, 9 May 2012 13:00:09 +0000
(14:00 +0100)
src/backend/utils/adt/xid.c
patch
|
blob
|
blame
|
history
diff --git
a/src/backend/utils/adt/xid.c
b/src/backend/utils/adt/xid.c
index fcde92cb8a8f83958e175f10d223e291b3365a43..7db6bb1a66083e4d4f25e0f6d20f2ed46d1d1721 100644
(file)
--- a/
src/backend/utils/adt/xid.c
+++ b/
src/backend/utils/adt/xid.c
@@
-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))