>From 67a566a57b66e1e47430f9b74fc82228e1c9130f Mon Sep 17 00:00:00 2001
From: Andres Freund <andres@anarazel.de>
Date: Wed, 30 Apr 2014 17:18:55 +0200
Subject: [PATCH 1/4] Assert that pre/post-fix updated tuples are on the same
 page during replay.

If they were not 'oldtup.t_data' would be dereferenced while set to
NULL in case of a full page image for block 0.

Do so primarily to silenence coverity; but also to make sure this
prerequisite isn't changed without adapting the replay routine as that
would appear to work in many cases.
---
 src/backend/access/heap/heapam.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index a047632..336fbb0 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8115,11 +8115,13 @@ newsame:;
 
 	if (xlrec->flags & XLOG_HEAP_PREFIX_FROM_OLD)
 	{
+		Assert(samepage);
 		memcpy(&prefixlen, recdata, sizeof(uint16));
 		recdata += sizeof(uint16);
 	}
 	if (xlrec->flags & XLOG_HEAP_SUFFIX_FROM_OLD)
 	{
+		Assert(samepage);
 		memcpy(&suffixlen, recdata, sizeof(uint16));
 		recdata += sizeof(uint16);
 	}
-- 
1.8.3.251.g1462b67

