summaryrefslogtreecommitdiff
path: root/src/backend/replication/logical
diff options
context:
space:
mode:
authorPeter Eisentraut2025-02-03 07:14:27 +0000
committerPeter Eisentraut2025-02-03 09:53:18 +0000
commit622f678c10202c8a0b350794d504eeef7b773e90 (patch)
tree7ff9730b065921fa91afe7f3c79243ccf5d478bc /src/backend/replication/logical
parent43a15eb9400dba2b0b97be72d1a3745a6a6f7136 (diff)
Integrate GistTranslateCompareType() into IndexAmTranslateCompareType()
This turns GistTranslateCompareType() into a callback function of the gist index AM instead of a standalone function. The existing callers are changed to use IndexAmTranslateCompareType(). This then makes that code not hardcoded toward gist. This means in particular that the temporal keys code is now independent of gist. Also, this generalizes commit 74edabce7a3, so other index access methods other than the previously hardcoded ones could now work as REPLICA IDENTITY in a logical replication subscriber. Author: Mark Dilger <[email protected]> Co-authored-by: Peter Eisentraut <[email protected]> Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/backend/replication/logical')
-rw-r--r--src/backend/replication/logical/relation.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/backend/replication/logical/relation.c b/src/backend/replication/logical/relation.c
index 67aab02ff76..e9ad90d64a5 100644
--- a/src/backend/replication/logical/relation.c
+++ b/src/backend/replication/logical/relation.c
@@ -27,6 +27,7 @@
#include "replication/logicalrelation.h"
#include "replication/worker_internal.h"
#include "utils/inval.h"
+#include "utils/lsyscache.h"
#include "utils/syscache.h"
@@ -835,7 +836,12 @@ IsIndexUsableForReplicaIdentityFull(Relation idxrel, AttrMap *attrmap)
/* Ensure that the index has a valid equal strategy for each key column */
for (int i = 0; i < idxrel->rd_index->indnkeyatts; i++)
{
- if (get_equal_strategy_number(indclass->values[i]) == InvalidStrategy)
+ Oid opfamily;
+ Oid opcintype;
+
+ if (!get_opclass_opfamily_and_input_type(indclass->values[i], &opfamily, &opcintype))
+ return false;
+ if (IndexAmTranslateCompareType(COMPARE_EQ, idxrel->rd_rel->relam, opfamily, opcintype, true) == InvalidStrategy)
return false;
}