diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-02-03 08:14:27 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-02-03 10:53:18 +0100 |
commit | 622f678c10202c8a0b350794d504eeef7b773e90 (patch) | |
tree | 7ff9730b065921fa91afe7f3c79243ccf5d478bc /src/backend/executor/execReplication.c | |
parent | 43a15eb9400dba2b0b97be72d1a3745a6a6f7136 (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 <mark.dilger@enterprisedb.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
Diffstat (limited to 'src/backend/executor/execReplication.c')
-rw-r--r-- | src/backend/executor/execReplication.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 2dac4bd363b..5f7613cc831 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -39,35 +39,6 @@ static bool tuples_equal(TupleTableSlot *slot1, TupleTableSlot *slot2, TypeCacheEntry **eq); /* - * Returns the fixed strategy number, if any, of the equality operator for the - * given operator class, otherwise, InvalidStrategy. - */ -StrategyNumber -get_equal_strategy_number(Oid opclass) -{ - Oid am = get_opclass_method(opclass); - int ret; - - switch (am) - { - case BTREE_AM_OID: - ret = BTEqualStrategyNumber; - break; - case HASH_AM_OID: - ret = HTEqualStrategyNumber; - break; - case GIST_AM_OID: - ret = GistTranslateCompareType(opclass, COMPARE_EQ); - break; - default: - ret = InvalidStrategy; - break; - } - - return ret; -} - -/* * Setup a ScanKey for a search in the relation 'rel' for a tuple 'key' that * is setup to match 'rel' (*NOT* idxrel!). * @@ -120,10 +91,7 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Relation idxrel, */ optype = get_opclass_input_type(opclass->values[index_attoff]); opfamily = get_opclass_family(opclass->values[index_attoff]); - eq_strategy = get_equal_strategy_number(opclass->values[index_attoff]); - if (!eq_strategy) - elog(ERROR, "missing equal strategy for opclass %u", opclass->values[index_attoff]); - + eq_strategy = IndexAmTranslateCompareType(COMPARE_EQ, idxrel->rd_rel->relam, opfamily, optype, false); operator = get_opfamily_member(opfamily, optype, optype, eq_strategy); |