diff options
Diffstat (limited to 'src/backend/access/gist')
-rw-r--r-- | src/backend/access/gist/gistutil.c | 35 | ||||
-rw-r--r-- | src/backend/access/gist/gistvalidate.c | 2 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index a2fcfbe4807..48db718b904 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -1058,27 +1058,44 @@ gistGetFakeLSN(Relation rel) } /* - * Returns the same number that was received. - * - * This is for GiST opclasses that use the RT*StrategyNumber constants. + * This is a stratnum support function for GiST opclasses that use the + * RT*StrategyNumber constants. */ Datum -gist_stratnum_identity(PG_FUNCTION_ARGS) +gist_stratnum_common(PG_FUNCTION_ARGS) { - StrategyNumber strat = PG_GETARG_UINT16(0); + CompareType cmptype = PG_GETARG_INT32(0); - PG_RETURN_UINT16(strat); + switch (cmptype) + { + case COMPARE_EQ: + PG_RETURN_UINT16(RTEqualStrategyNumber); + case COMPARE_LT: + PG_RETURN_UINT16(RTLessStrategyNumber); + case COMPARE_LE: + PG_RETURN_UINT16(RTLessEqualStrategyNumber); + case COMPARE_GT: + PG_RETURN_UINT16(RTGreaterStrategyNumber); + case COMPARE_GE: + PG_RETURN_UINT16(RTGreaterEqualStrategyNumber); + case COMPARE_OVERLAP: + PG_RETURN_UINT16(RTOverlapStrategyNumber); + case COMPARE_CONTAINED_BY: + PG_RETURN_UINT16(RTContainedByStrategyNumber); + default: + PG_RETURN_UINT16(InvalidStrategy); + } } /* - * Returns the opclass's private stratnum used for the given strategy. + * Returns the opclass's private stratnum used for the given compare type. * * Calls the opclass's GIST_STRATNUM_PROC support function, if any, * and returns the result. * Returns InvalidStrategy if the function is not defined. */ StrategyNumber -GistTranslateStratnum(Oid opclass, StrategyNumber strat) +GistTranslateStratnum(Oid opclass, CompareType cmptype) { Oid opfamily; Oid opcintype; @@ -1095,6 +1112,6 @@ GistTranslateStratnum(Oid opclass, StrategyNumber strat) return InvalidStrategy; /* Ask the translation function */ - result = OidFunctionCall1Coll(funcid, InvalidOid, UInt16GetDatum(strat)); + result = OidFunctionCall1Coll(funcid, InvalidOid, Int32GetDatum(cmptype)); return DatumGetUInt16(result); } diff --git a/src/backend/access/gist/gistvalidate.c b/src/backend/access/gist/gistvalidate.c index 499ed8c8748..bb86b559486 100644 --- a/src/backend/access/gist/gistvalidate.c +++ b/src/backend/access/gist/gistvalidate.c @@ -148,7 +148,7 @@ gistvalidate(Oid opclassoid) break; case GIST_STRATNUM_PROC: ok = check_amproc_signature(procform->amproc, INT2OID, true, - 1, 1, INT2OID); + 1, 1, INT4OID); break; default: ereport(INFO, |