From 56d92b1903b4c3987a2c4525f9fa4a1e65b3ff4e Mon Sep 17 00:00:00 2001 From: movead Date: Tue, 2 Apr 2024 10:54:13 +0800 Subject: [PATCH] fix xid_age function show negative result if there be big gap --- src/common/backend/utils/adt/xid.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/backend/utils/adt/xid.cpp b/src/common/backend/utils/adt/xid.cpp index 03081e9ff..1bb4ac866 100644 --- a/src/common/backend/utils/adt/xid.cpp +++ b/src/common/backend/utils/adt/xid.cpp @@ -178,9 +178,9 @@ Datum xid_age(PG_FUNCTION_ARGS) /* Permanent XIDs are always infinitely old */ if (!TransactionIdIsNormal(xid)) - PG_RETURN_INT64(INT64_MAX); + PG_RETURN_TRANSACTIONID(UINT64_MAX); - PG_RETURN_INT64((int64)(now - xid)); + PG_RETURN_TRANSACTIONID((TransactionId)(now - xid)); } /*