From 45a6d79b1764a78301ef008f4561b5e176352331 Mon Sep 17 00:00:00 2001
From: Magnus Hagander <magnus@hagander.net>
Date: Fri, 18 Feb 2011 11:59:57 +0100
Subject: [PATCH] Properly initialize variables

Kevin Grittner
---
 src/backend/storage/lmgr/predicate.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/backend/storage/lmgr/predicate.c b/src/backend/storage/lmgr/predicate.c
index e2d79e20b44..d660ce5af78 100644
--- a/src/backend/storage/lmgr/predicate.c
+++ b/src/backend/storage/lmgr/predicate.c
@@ -2535,9 +2535,12 @@ TransferPredicateLocksToNewTarget(const PREDICATELOCKTARGETTAG oldtargettag,
 		if (!found)
 		{
 			SHMQueueInit(&(newtarget->predicateLocks));
-			newpredlocktag.myTarget = newtarget;
+			newtarget->priorVersionOfRow = NULL;
+			newtarget->nextVersionOfRow = NULL;
 		}
 
+		newpredlocktag.myTarget = newtarget;
+
 		oldpredlock = (PREDICATELOCK *)
 			SHMQueueNext(&(oldtarget->predicateLocks),
 						 &(oldtarget->predicateLocks),
@@ -2586,10 +2589,14 @@ TransferPredicateLocksToNewTarget(const PREDICATELOCKTARGETTAG oldtargettag,
 				outOfShmem = true;
 				goto exit;
 			}
-			SHMQueueInsertBefore(&(newtarget->predicateLocks),
-								 &(newpredlock->targetLink));
-			SHMQueueInsertBefore(&(newpredlocktag.myXact->predicateLocks),
-								 &(newpredlock->xactLink));
+			if (!found)
+			{
+				SHMQueueInsertBefore(&(newtarget->predicateLocks),
+									 &(newpredlock->targetLink));
+				SHMQueueInsertBefore(&(newpredlocktag.myXact->predicateLocks),
+									 &(newpredlock->xactLink));
+				newpredlock->commitSeqNo = InvalidSerCommitSeqNo;
+			}
 
 			oldpredlock = nextpredlock;
 		}
-- 
GitLab