From 0b595189077c4310cc6ce6d8b08ffa5b40a0f1cc Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 24 Jan 2025 15:49:40 +0100 Subject: [PATCH v19.2 1/6] Rename GistTranslateStratnum() to GistTranslateCompareType() Follow up to commit 630f9a43cec. The previous name had become confusing, because it doesn't actually translate a strategy number but a CompareType into a strategy number. We might add the inverse at some point, which would then probably be called something like GistTranslateStratnum. --- src/backend/access/gist/gistutil.c | 2 +- src/backend/commands/indexcmds.c | 2 +- src/backend/commands/tablecmds.c | 4 ++-- src/backend/executor/execReplication.c | 2 +- src/include/access/gist.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index 48db718b904..4d3b6dfa32b 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -1095,7 +1095,7 @@ gist_stratnum_common(PG_FUNCTION_ARGS) * Returns InvalidStrategy if the function is not defined. */ StrategyNumber -GistTranslateStratnum(Oid opclass, CompareType cmptype) +GistTranslateCompareType(Oid opclass, CompareType cmptype) { Oid opfamily; Oid opcintype; diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 59c836fc24d..0aa15a42efe 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -2455,7 +2455,7 @@ GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype, * For now we only need GiST support, but this could support other * indexams if we wanted. */ - *strat = GistTranslateStratnum(opclass, cmptype); + *strat = GistTranslateCompareType(opclass, cmptype); if (*strat == InvalidStrategy) { HeapTuple tuple; diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 57662fd7662..d51298284f6 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -10016,7 +10016,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, * ask the opclass what number it actually uses instead of our RT* * constants. */ - eqstrategy = GistTranslateStratnum(opclasses[i], cmptype); + eqstrategy = GistTranslateCompareType(opclasses[i], cmptype); if (eqstrategy == InvalidStrategy) { HeapTuple tuple; @@ -10041,7 +10041,7 @@ ATAddForeignKeyConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel, * other index AMs support unique indexes. If we ever did have * other types of unique indexes, we'd need a way to determine * which operator strategy number is equality. (We could use - * something like GistTranslateStratnum.) + * something like GistTranslateCompareType.) */ if (amid != BTREE_AM_OID) elog(ERROR, "only b-tree indexes are supported for foreign keys"); diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 3985e84d3a6..2dac4bd363b 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -57,7 +57,7 @@ get_equal_strategy_number(Oid opclass) ret = HTEqualStrategyNumber; break; case GIST_AM_OID: - ret = GistTranslateStratnum(opclass, COMPARE_EQ); + ret = GistTranslateCompareType(opclass, COMPARE_EQ); break; default: ret = InvalidStrategy; diff --git a/src/include/access/gist.h b/src/include/access/gist.h index 2f419a3b309..eff019f7515 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -248,6 +248,6 @@ typedef struct do { (e).key = (k); (e).rel = (r); (e).page = (pg); \ (e).offset = (o); (e).leafkey = (l); } while (0) -extern StrategyNumber GistTranslateStratnum(Oid opclass, CompareType cmp); +extern StrategyNumber GistTranslateCompareType(Oid opclass, CompareType cmptype); #endif /* GIST_H */ -- 2.48.1