diff --git a/src/backend/access/heap/heapam_visibility.c b/src/backend/access/heap/heapam_visibility.c
index d3c57cd16a..5830df83c2 100644
--- a/src/backend/access/heap/heapam_visibility.c
+++ b/src/backend/access/heap/heapam_visibility.c
@@ -73,11 +73,14 @@
 #include "access/xlog.h"
 #include "storage/bufmgr.h"
 #include "storage/procarray.h"
+#include "tcop/tcopprot.h"
 #include "utils/builtins.h"
 #include "utils/combocid.h"
 #include "utils/snapmgr.h"
 
 
+bool trace_toast_visibility = false;
+
 /*
  * SetHintBits()
  *
@@ -366,6 +369,13 @@ HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot,
 	Assert(ItemPointerIsValid(&htup->t_self));
 	Assert(htup->t_tableOid != InvalidOid);
 
+	if (trace_toast_visibility)
+		ereport(LOG,
+				errmsg("HeapTupleSatisfiesToast: xmin %u t_infomask 0x%04x",
+					   HeapTupleHeaderGetXmin(tuple),
+					   tuple->t_infomask),
+				debug_query_string ? 0 : errbacktrace());
+
 	if (!HeapTupleHeaderXminCommitted(tuple))
 	{
 		if (HeapTupleHeaderXminInvalid(tuple))
@@ -420,6 +430,11 @@ HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot,
 			return false;
 	}
 
+	if (trace_toast_visibility)
+		elog(LOG, "HeapTupleSatisfiesToast: xmin %u t_infomask 0x%04x OK",
+			 HeapTupleHeaderGetXmin(tuple),
+			 tuple->t_infomask);
+
 	/* otherwise assume the tuple is valid for TOAST. */
 	return true;
 }
diff --git a/src/backend/access/heap/heaptoast.c b/src/backend/access/heap/heaptoast.c
index 55bbe1d584..03ea2dc80d 100644
--- a/src/backend/access/heap/heaptoast.c
+++ b/src/backend/access/heap/heaptoast.c
@@ -781,7 +781,7 @@ heap_fetch_toast_slice(Relation toastrel, Oid valueid, int32 attrsize,
 	 * Final checks that we successfully fetched the datum
 	 */
 	if (expectedchunk != (endchunk + 1))
-		ereport(ERROR,
+		ereport(PANIC,
 				(errcode(ERRCODE_DATA_CORRUPTED),
 				 errmsg_internal("missing chunk number %d for toast value %u in %s",
 								 expectedchunk, valueid,
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index 4fbdc62d8c..a1f923e02c 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -23,6 +23,7 @@
 #include "access/xact.h"
 #include "catalog/pg_collation.h"
 #include "catalog/pg_operator.h"
+#include "catalog/pg_statistic.h"
 #include "catalog/pg_type.h"
 #include "common/hashfn.h"
 #include "miscadmin.h"
@@ -39,6 +40,7 @@
 #include "utils/resowner_private.h"
 #include "utils/syscache.h"
 
+extern bool trace_toast_visibility;
 
  /* #define CACHEDEBUG */	/* turns DEBUG elogs on */
 
@@ -1810,6 +1812,7 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
 {
 	CatCTup    *ct;
 	HeapTuple	dtp;
+	bool makedead = false;
 	MemoryContext oldcxt;
 
 	/* negative entries have no tuple associated */
@@ -1827,7 +1830,16 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
 		 * something using a slightly stale catcache entry.
 		 */
 		if (HeapTupleHasExternal(ntp))
+		{
+			if (cache->cc_reloid == StatisticRelationId)
+			{
+				pg_usleep(100000);
+				makedead = true;
+				trace_toast_visibility = true;
+			}
 			dtp = toast_flatten_tuple(ntp, cache->cc_tupdesc);
+			trace_toast_visibility = false;
+		}
 		else
 			dtp = ntp;
 
@@ -1887,7 +1899,7 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp, Datum *arguments,
 	ct->my_cache = cache;
 	ct->c_list = NULL;
 	ct->refcount = 0;			/* for the moment */
-	ct->dead = false;
+	ct->dead = makedead;
 	ct->negative = negative;
 	ct->hash_value = hashValue;
 
