diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index f68483e..bff8189 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -1036,7 +1036,8 @@ SearchCatCache(CatCache *cache,
 			   Datum v1,
 			   Datum v2,
 			   Datum v3,
-			   Datum v4)
+			   Datum v4,
+			   Datum v5)
 {
 	ScanKeyData cur_skey[CATCACHE_MAXKEYS];
 	uint32		hashValue;
@@ -1065,6 +1066,7 @@ SearchCatCache(CatCache *cache,
 	cur_skey[1].sk_argument = v2;
 	cur_skey[2].sk_argument = v3;
 	cur_skey[3].sk_argument = v4;
+	cur_skey[4].sk_argument = v5;
 
 	/*
 	 * find the hash bucket in which to look for the tuple
@@ -1277,7 +1279,8 @@ SearchCatCacheList(CatCache *cache,
 				   Datum v1,
 				   Datum v2,
 				   Datum v3,
-				   Datum v4)
+				   Datum v4,
+				   Datum v5)
 {
 	ScanKeyData cur_skey[CATCACHE_MAXKEYS];
 	uint32		lHashValue;
@@ -1312,6 +1315,7 @@ SearchCatCacheList(CatCache *cache,
 	cur_skey[1].sk_argument = v2;
 	cur_skey[2].sk_argument = v3;
 	cur_skey[3].sk_argument = v4;
+	cur_skey[4].sk_argument = v5;
 
 	/*
 	 * compute a hash value of the given keys for faster search.  We don't
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index 61b06ac..6948392 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -95,7 +95,7 @@ struct cachedesc
 	Oid			reloid;			/* OID of the relation being cached */
 	Oid			indoid;			/* OID of index relation for this cache */
 	int			nkeys;			/* # of keys needed for cache lookup */
-	int			key[4];			/* attribute numbers of key attrs */
+	int			key[CATCACHE_MAXKEYS];	/* attribute numbers of key attrs */
 	int			nbuckets;		/* number of hash buckets for this cache */
 };
 
@@ -803,13 +803,14 @@ SearchSysCache(int cacheId,
 			   Datum key1,
 			   Datum key2,
 			   Datum key3,
-			   Datum key4)
+			   Datum key4,
+			   Datum key5)
 {
 	if (cacheId < 0 || cacheId >= SysCacheSize ||
 		!PointerIsValid(SysCache[cacheId]))
 		elog(ERROR, "invalid cache id: %d", cacheId);
 
-	return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4);
+	return SearchCatCache(SysCache[cacheId], key1, key2, key3, key4, key5);
 }
 
 /*
@@ -835,12 +836,13 @@ SearchSysCacheCopy(int cacheId,
 				   Datum key1,
 				   Datum key2,
 				   Datum key3,
-				   Datum key4)
+				   Datum key4,
+				   Datum key5)
 {
 	HeapTuple	tuple,
 				newtuple;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return tuple;
 	newtuple = heap_copytuple(tuple);
@@ -859,11 +861,12 @@ SearchSysCacheExists(int cacheId,
 					 Datum key1,
 					 Datum key2,
 					 Datum key3,
-					 Datum key4)
+					 Datum key4,
+					 Datum key5)
 {
 	HeapTuple	tuple;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return false;
 	ReleaseSysCache(tuple);
@@ -882,12 +885,13 @@ GetSysCacheOid(int cacheId,
 			   Datum key1,
 			   Datum key2,
 			   Datum key3,
-			   Datum key4)
+			   Datum key4,
+			   Datum key5)
 {
 	HeapTuple	tuple;
 	Oid			result;
 
-	tuple = SearchSysCache(cacheId, key1, key2, key3, key4);
+	tuple = SearchSysCache(cacheId, key1, key2, key3, key4, key5);
 	if (!HeapTupleIsValid(tuple))
 		return InvalidOid;
 	result = HeapTupleGetOid(tuple);
@@ -1008,12 +1012,12 @@ SysCacheGetAttr(int cacheId, HeapTuple tup,
  */
 struct catclist *
 SearchSysCacheList(int cacheId, int nkeys,
-				   Datum key1, Datum key2, Datum key3, Datum key4)
+				   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5)
 {
 	if (cacheId < 0 || cacheId >= SysCacheSize ||
 		!PointerIsValid(SysCache[cacheId]))
 		elog(ERROR, "invalid cache id: %d", cacheId);
 
 	return SearchCatCacheList(SysCache[cacheId], nkeys,
-							  key1, key2, key3, key4);
+							  key1, key2, key3, key4, key5);
 }
diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h
index 0db116d..64e683e 100644
--- a/src/include/utils/catcache.h
+++ b/src/include/utils/catcache.h
@@ -32,7 +32,7 @@
  *		struct catcacheheader:	information for managing all the caches.
  */
 
-#define CATCACHE_MAXKEYS		4
+#define CATCACHE_MAXKEYS		5
 
 typedef struct catcache
 {
@@ -171,12 +171,14 @@ extern void InitCatCachePhase2(CatCache *cache, bool touch_index);
 
 extern HeapTuple SearchCatCache(CatCache *cache,
 			   Datum v1, Datum v2,
-			   Datum v3, Datum v4);
+			   Datum v3, Datum v4,
+			   Datum v5);
 extern void ReleaseCatCache(HeapTuple tuple);
 
 extern CatCList *SearchCatCacheList(CatCache *cache, int nkeys,
 				   Datum v1, Datum v2,
-				   Datum v3, Datum v4);
+				   Datum v3, Datum v4,
+				   Datum v5);
 extern void ReleaseCatCacheList(CatCList *list);
 
 extern void ResetCatalogCaches(void);
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 2f19e5c..cf8840b 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -91,16 +91,17 @@ extern void InitCatalogCache(void);
 extern void InitCatalogCachePhase2(void);
 
 extern HeapTuple SearchSysCache(int cacheId,
-			   Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 extern void ReleaseSysCache(HeapTuple tuple);
 
 /* convenience routines */
 extern HeapTuple SearchSysCacheCopy(int cacheId,
-				   Datum key1, Datum key2, Datum key3, Datum key4);
+				   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 extern bool SearchSysCacheExists(int cacheId,
-					 Datum key1, Datum key2, Datum key3, Datum key4);
+					 Datum key1, Datum key2, Datum key3,
+					 Datum key4, Datum key5);
 extern Oid GetSysCacheOid(int cacheId,
-			   Datum key1, Datum key2, Datum key3, Datum key4);
+			   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 
 extern HeapTuple SearchSysCacheAttName(Oid relid, const char *attname);
 extern HeapTuple SearchSysCacheCopyAttName(Oid relid, const char *attname);
@@ -111,7 +112,7 @@ extern Datum SysCacheGetAttr(int cacheId, HeapTuple tup,
 
 /* list-search interface.  Users of this must import catcache.h too */
 extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
-				   Datum key1, Datum key2, Datum key3, Datum key4);
+				   Datum key1, Datum key2, Datum key3, Datum key4, Datum key5);
 
 /*
  * The use of the macros below rather than direct calls to the corresponding
@@ -119,49 +120,59 @@ extern struct catclist *SearchSysCacheList(int cacheId, int nkeys,
  * maximum number of keys.
  */
 #define SearchSysCache1(cacheId, key1) \
-	SearchSysCache(cacheId, key1, 0, 0, 0)
+	SearchSysCache(cacheId, key1, 0, 0, 0, 0)
 #define SearchSysCache2(cacheId, key1, key2) \
-	SearchSysCache(cacheId, key1, key2, 0, 0)
+	SearchSysCache(cacheId, key1, key2, 0, 0, 0)
 #define SearchSysCache3(cacheId, key1, key2, key3) \
-	SearchSysCache(cacheId, key1, key2, key3, 0)
+	SearchSysCache(cacheId, key1, key2, key3, 0, 0)
 #define SearchSysCache4(cacheId, key1, key2, key3, key4) \
-	SearchSysCache(cacheId, key1, key2, key3, key4)
+	SearchSysCache(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCache5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCache(cacheId, key1, key2, key3, key4, key5)
 
 #define SearchSysCacheCopy1(cacheId, key1) \
-	SearchSysCacheCopy(cacheId, key1, 0, 0, 0)
+	SearchSysCacheCopy(cacheId, key1, 0, 0, 0, 0)
 #define SearchSysCacheCopy2(cacheId, key1, key2) \
-	SearchSysCacheCopy(cacheId, key1, key2, 0, 0)
+	SearchSysCacheCopy(cacheId, key1, key2, 0, 0, 0)
 #define SearchSysCacheCopy3(cacheId, key1, key2, key3) \
-	SearchSysCacheCopy(cacheId, key1, key2, key3, 0)
+	SearchSysCacheCopy(cacheId, key1, key2, key3, 0, 0)
 #define SearchSysCacheCopy4(cacheId, key1, key2, key3, key4) \
-	SearchSysCacheCopy(cacheId, key1, key2, key3, key4)
+	SearchSysCacheCopy(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCacheCopy5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheCopy(cacheId, key1, key2, key3, key4, key5)
 
 #define SearchSysCacheExists1(cacheId, key1) \
-	SearchSysCacheExists(cacheId, key1, 0, 0, 0)
+	SearchSysCacheExists(cacheId, key1, 0, 0, 0, 0)
 #define SearchSysCacheExists2(cacheId, key1, key2) \
-	SearchSysCacheExists(cacheId, key1, key2, 0, 0)
+	SearchSysCacheExists(cacheId, key1, key2, 0, 0, 0)
 #define SearchSysCacheExists3(cacheId, key1, key2, key3) \
-	SearchSysCacheExists(cacheId, key1, key2, key3, 0)
+	SearchSysCacheExists(cacheId, key1, key2, key3, 0, 0)
 #define SearchSysCacheExists4(cacheId, key1, key2, key3, key4) \
-	SearchSysCacheExists(cacheId, key1, key2, key3, key4)
+	SearchSysCacheExists(cacheId, key1, key2, key3, key4, 0)
+#define SearchSysCacheExists5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheExists(cacheId, key1, key2, key3, key4, key5)
 
 #define GetSysCacheOid1(cacheId, key1) \
-	GetSysCacheOid(cacheId, key1, 0, 0, 0)
+	GetSysCacheOid(cacheId, key1, 0, 0, 0, 0)
 #define GetSysCacheOid2(cacheId, key1, key2) \
-	GetSysCacheOid(cacheId, key1, key2, 0, 0)
+	GetSysCacheOid(cacheId, key1, key2, 0, 0, 0)
 #define GetSysCacheOid3(cacheId, key1, key2, key3) \
-	GetSysCacheOid(cacheId, key1, key2, key3, 0)
+	GetSysCacheOid(cacheId, key1, key2, key3, 0, 0)
 #define GetSysCacheOid4(cacheId, key1, key2, key3, key4) \
-	GetSysCacheOid(cacheId, key1, key2, key3, key4)
+	GetSysCacheOid(cacheId, key1, key2, key3, key4, 0)
+#define GetSysCacheOid5(cacheId, key1, key2, key3, key4, key5) \
+	GetSysCacheOid(cacheId, key1, key2, key3, key4, key5)
 
 #define SearchSysCacheList1(cacheId, key1) \
-	SearchSysCacheList(cacheId, 1, key1, 0, 0, 0)
+	SearchSysCacheList(cacheId, 1, key1, 0, 0, 0, 0)
 #define SearchSysCacheList2(cacheId, key1, key2) \
-	SearchSysCacheList(cacheId, 2, key1, key2, 0, 0)
+	SearchSysCacheList(cacheId, 2, key1, key2, 0, 0, 0)
 #define SearchSysCacheList3(cacheId, key1, key2, key3) \
-	SearchSysCacheList(cacheId, 3, key1, key2, key3, 0)
+	SearchSysCacheList(cacheId, 3, key1, key2, key3, 0, 0)
 #define SearchSysCacheList4(cacheId, key1, key2, key3, key4) \
-	SearchSysCacheList(cacheId, 4, key1, key2, key3, key4)
+	SearchSysCacheList(cacheId, 4, key1, key2, key3, key4, 0)
+#define SearchSysCacheList5(cacheId, key1, key2, key3, key4, key5) \
+	SearchSysCacheList(cacheId, 4, key1, key2, key3, key4, key5)
 
 #define ReleaseSysCacheList(x)	ReleaseCatCacheList(x)
 