0003-Support-for-GIST-in-get_equal_strategy_numbe.patch.nocfbot

text/plain

Filename: 0003-Support-for-GIST-in-get_equal_strategy_numbe.patch.nocfbot
Type: text/plain
Part: 2
Message: Re: SQL:2011 application time
From a46139648ac7c4de927315158b66c15bd2fd5360 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 26 Nov 2024 11:57:08 +0100
Subject: [PATCH 3/3] Support for GIST in get_equal_strategy_number()

---
 src/backend/executor/execReplication.c     | 9 ++++-----
 src/backend/replication/logical/relation.c | 2 +-
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 8313ccdb46b..0fa67adb990 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -15,6 +15,7 @@
 #include "postgres.h"
 
 #include "access/genam.h"
+#include "access/gist.h"
 #include "access/relscan.h"
 #include "access/tableam.h"
 #include "access/transam.h"
@@ -40,11 +41,6 @@ static bool tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2,
 /*
  * Returns the fixed strategy number, if any, of the equality operator for the
  * given operator class, otherwise, InvalidStrategy.
- *
- * Currently, only Btree and Hash indexes are supported. The other index access
- * methods don't have a fixed strategy for equality operation - instead, the
- * support routines of each operator class interpret the strategy numbers
- * according to the operator class's definition.
  */
 StrategyNumber
 get_equal_strategy_number(Oid opclass)
@@ -60,6 +56,9 @@ get_equal_strategy_number(Oid opclass)
 		case HASH_AM_OID:
 			ret = HTEqualStrategyNumber;
 			break;
+		case GIST_AM_OID:
+			ret = GistTranslateStratnum(opclass, RTEqualStrategyNumber);
+			break;
 		default:
 			/* XXX: Only Btree and Hash indexes are supported */
 			ret = InvalidStrategy;
diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c
index 7cda6a792a2..f686975f39d 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -782,7 +782,7 @@ FindUsableIndexForReplicaIdentityFull(Relation localrel, AttrMap *attrmap)
  * compare the tuples for non-PK/RI index scans. See
  * RelationFindReplTupleByIndex().
  *
- * The reasons why only Btree and Hash indexes can be considered as usable are:
+ * The reasons why only Btree and Hash indexes can be considered as usable are: XXX
  *
  * 1) Other index access methods don't have a fixed strategy for equality
  * operation. Refer get_equal_strategy_number().
-- 
2.47.0