From 33a716b9f60fffaa916eb76ba15c2d4328496745 Mon Sep 17 00:00:00 2001
From: Peter Geoghegan <pg@bowt.ie>
Date: Wed, 29 Sep 2021 14:07:00 -0700
Subject: [PATCH v1] Enable deduplication in system catalog indexes.

---
 src/backend/access/nbtree/nbtutils.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c
index d52431072..39f2e7518 100644
--- a/src/backend/access/nbtree/nbtutils.c
+++ b/src/backend/access/nbtree/nbtutils.c
@@ -2698,18 +2698,6 @@ _bt_allequalimage(Relation rel, bool debugmessage)
 		IndexRelationGetNumberOfKeyAttributes(rel))
 		return false;
 
-	/*
-	 * There is no special reason why deduplication cannot work with system
-	 * relations (i.e. with system catalog indexes and TOAST indexes).  We
-	 * deem deduplication unsafe for these indexes all the same, since the
-	 * alternative is to force users to always use deduplication, without
-	 * being able to opt out.  (ALTER INDEX is not supported with system
-	 * indexes, so users would have no way to set the deduplicate_items
-	 * storage parameter to 'off'.)
-	 */
-	if (IsSystemRelation(rel))
-		return false;
-
 	for (int i = 0; i < IndexRelationGetNumberOfKeyAttributes(rel); i++)
 	{
 		Oid			opfamily = rel->rd_opfamily[i];
-- 
2.27.0

