From 9975c683b102d06ed5d5ab799eaba0d00a9ff38c Mon Sep 17 00:00:00 2001
From: Simon Riggs <simon@2ndQuadrant.com>
Date: Thu, 9 Dec 2010 10:20:49 +0000
Subject: [PATCH] Self review of previous patch. Fix assumption that xmax >=
 xmin.

---
 src/backend/access/heap/heapam.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index cfbbc6301e3..4fe3a739109 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -3809,11 +3809,9 @@ HeapTupleHeaderAdvanceLatestRemovedXid(HeapTupleHeader tuple,
 		 !(tuple->t_infomask & HEAP_XMIN_INVALID) &&
 		 TransactionIdDidCommit(xmin)))
 	{
-		if (TransactionIdFollows(xmax, xmin))
-		{
-			if (TransactionIdFollows(xmax, *latestRemovedXid))
+		if (xmax != xmin &&
+			TransactionIdFollows(xmax, *latestRemovedXid))
 				*latestRemovedXid = xmax;
-		}
 	}
 
 	/* *latestRemovedXid may still be invalid at end */
-- 
GitLab