mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Drop opcintype from index AM strategy translation API
The type argument wasn't actually really necessary. It was a remnant of converting the API of the gist strategy translation from using opclass to using opfamily+opcintype (commitsc09e5a6a01,622f678c10). For looking up the gist translation function, we used the convention "amproclefttype = amprocrighttype = opclass's opcintype" (see pg_amproc.h). But each operator family should only have one translation function, and getting the right type for the lookup is sometimes cumbersome and fragile, so this is all unnecessarily complicated. To simplify this, change the gist stategy support procedure to take "any", "any" as argument. (This is arbitrary but seems intuitive. The alternative of using InvalidOid as argument(s) upsets various DDL commands, so it's not practical.) Then we don't need opcintype for the lookup, and we can remove it from all the API layers introduced by commitc09e5a6a01. This also adds some more documentation about the correct signature of the gist support function and adds more checks in gistvalidate(). This was previously underspecified. (It relied implicitly on convention mentioned above.) Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
This commit is contained in:
@@ -102,10 +102,10 @@ typedef struct OpFamilyMember
|
||||
*/
|
||||
|
||||
/* translate AM-specific strategies to general operator types */
|
||||
typedef CompareType (*amtranslate_strategy_function) (StrategyNumber strategy, Oid opfamily, Oid opcintype);
|
||||
typedef CompareType (*amtranslate_strategy_function) (StrategyNumber strategy, Oid opfamily);
|
||||
|
||||
/* translate general operator types to AM-specific strategies */
|
||||
typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype, Oid opfamily, Oid opcintype);
|
||||
typedef StrategyNumber (*amtranslate_cmptype_function) (CompareType cmptype, Oid opfamily);
|
||||
|
||||
/* build new index */
|
||||
typedef IndexBuildResult *(*ambuild_function) (Relation heapRelation,
|
||||
@@ -319,7 +319,7 @@ typedef struct IndexAmRoutine
|
||||
/* Functions in access/index/amapi.c */
|
||||
extern IndexAmRoutine *GetIndexAmRoutine(Oid amhandler);
|
||||
extern IndexAmRoutine *GetIndexAmRoutineByAmId(Oid amoid, bool noerror);
|
||||
extern CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, Oid opcintype, bool missing_ok);
|
||||
extern StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, Oid opcintype, bool missing_ok);
|
||||
extern CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, bool missing_ok);
|
||||
extern StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok);
|
||||
|
||||
#endif /* AMAPI_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 gisttranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype);
|
||||
extern StrategyNumber gisttranslatecmptype(CompareType cmptype, Oid opfamily);
|
||||
|
||||
#endif /* GIST_H */
|
||||
|
||||
@@ -387,8 +387,8 @@ extern void hashadjustmembers(Oid opfamilyoid,
|
||||
List *operators,
|
||||
List *functions);
|
||||
|
||||
extern CompareType hashtranslatestrategy(StrategyNumber strategy, Oid opfamily, Oid opcintype);
|
||||
extern StrategyNumber hashtranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype);
|
||||
extern CompareType hashtranslatestrategy(StrategyNumber strategy, Oid opfamily);
|
||||
extern StrategyNumber hashtranslatecmptype(CompareType cmptype, Oid opfamily);
|
||||
|
||||
/* private routines */
|
||||
|
||||
|
||||
@@ -1183,8 +1183,8 @@ extern IndexBulkDeleteResult *btvacuumcleanup(IndexVacuumInfo *info,
|
||||
extern bool btcanreturn(Relation index, int attno);
|
||||
extern int btgettreeheight(Relation rel);
|
||||
|
||||
extern CompareType bttranslatestrategy(StrategyNumber strategy, Oid opfamily, Oid opcintype);
|
||||
extern StrategyNumber bttranslatecmptype(CompareType cmptype, Oid opfamily, Oid opcintype);
|
||||
extern CompareType bttranslatestrategy(StrategyNumber strategy, Oid opfamily);
|
||||
extern StrategyNumber bttranslatecmptype(CompareType cmptype, Oid opfamily);
|
||||
|
||||
/*
|
||||
* prototypes for internal functions in nbtree.c
|
||||
|
||||
Reference in New Issue
Block a user