]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Rename GistTranslateStratnum() to GistTranslateCompareType()
authorPeter Eisentraut <peter@eisentraut.org>
Sat, 1 Feb 2025 09:18:46 +0000 (10:18 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Sat, 1 Feb 2025 09:18:46 +0000 (10:18 +0100)
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.

Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com

src/backend/access/gist/gistutil.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/executor/execReplication.c
src/include/access/gist.h

index 48db718b904032ad5ed7b9527f63c2532055d31b..4d3b6dfa32b3be601930291e529b8258309ccd57 100644 (file)
@@ -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;
index 59c836fc24d34f321cb125871dfd5eeb2267805e..0aa15a42efec024ad77e0d9a0a0ae7e9d740edf2 100644 (file)
@@ -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;
index d617c4bc63df23132b9e4bf82dc1dd08ff510f93..9827b27af8a6586c5a09a4eefafbaa4ea4bb5671 100644 (file)
@@ -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");
index 3985e84d3a6a2ee5c35c59f8feb2ea20735a7cfb..2dac4bd363b383439607537c58868e45022d0e75 100644 (file)
@@ -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;
index 2f419a3b30910783b3df3342582b120b7fd04adb..eff019f7515165906d40e17fed53f0ad02ebdb75 100644 (file)
@@ -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 */