From: PostgreSQL relcache v3 Linux review
Subject: [PATCH 4/4] Reset lazy index pointers after init-file load

RelationData is copied verbatim to relcache init files, but index expression,
predicate, and exclusion metadata are intentionally rebuilt lazily.  Reset
the five corresponding pointers after loading the serialized index data so
stale process addresses cannot survive into a new backend.

Depends on patch 1 and applies after David Geier's v3 patches 0001 through
0006, based on 9dbc53591a2de03e0cfdab61a78726f8b2c29eef.  The serialized
format is unchanged.
---
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index c4b7e01503b..c4192b255ef 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -6570,6 +6570,13 @@ load_relcache_init_file(bool shared)
 			nsupport = relform->relnatts * rel->rd_indam->amsupport;
 			rel->rd_supportinfo = (FmgrInfo *)
 				MemoryContextAllocZero(indexcxt, nsupport * sizeof(FmgrInfo));
+
+			/* These lazily built fields are not stored in the init file. */
+			rel->rd_indexprs = NIL;
+			rel->rd_indpred = NIL;
+			rel->rd_exclops = NULL;
+			rel->rd_exclprocs = NULL;
+			rel->rd_exclstrats = NULL;
 		}
 		else
 		{
