projects
/
users
/
rhaas
/
postgres.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c0e678
)
Avoid xid error from age() function when run on Hot Standby
author
Simon Riggs
<
[email protected]
>
Wed, 9 May 2012 12:59:30 +0000
(13:59 +0100)
committer
Simon Riggs
<
[email protected]
>
Wed, 9 May 2012 12:59:30 +0000
(13:59 +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 76d29ff2a379de01d0e895ccd3fc2601cfcadd13..229e8e43e69eedb8794bcbb821c4d9a5e4eceef0 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))