From 6db4598fcb82a87a683c4572707e522504830a2b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 19 Jan 2024 15:41:44 +0100 Subject: Add stratnum GiST support function This is support function 12 for the GiST AM and translates "well-known" RT*StrategyNumber values into whatever strategy number is used by the opclass (since no particular numbers are actually required). We will use this to support temporal PRIMARY KEY/UNIQUE/FOREIGN KEY/FOR PORTION OF functionality. This commit adds two implementations, one for internal GiST opclasses (just an identity function) and another for btree_gist opclasses. It updates btree_gist from 1.7 to 1.8, adding the support function for all its opclasses. Author: Paul A. Jungwirth Reviewed-by: Peter Eisentraut Reviewed-by: jian he Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com --- src/backend/access/gist/gistutil.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/backend/access/gist/gistutil.c') diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c index dddc08893a1..d4d08bd118f 100644 --- a/src/backend/access/gist/gistutil.c +++ b/src/backend/access/gist/gistutil.c @@ -23,6 +23,7 @@ #include "storage/indexfsm.h" #include "storage/lmgr.h" #include "utils/float.h" +#include "utils/fmgrprotos.h" #include "utils/lsyscache.h" #include "utils/snapmgr.h" #include "utils/syscache.h" @@ -1056,3 +1057,16 @@ gistGetFakeLSN(Relation rel) return GetFakeLSNForUnloggedRel(); } } + +/* + * Returns the same number that was received. + * + * This is for GiST opclasses that use the RT*StrategyNumber constants. + */ +Datum +gist_stratnum_identity(PG_FUNCTION_ARGS) +{ + StrategyNumber strat = PG_GETARG_UINT16(0); + + PG_RETURN_UINT16(strat); +} -- cgit v1.2.3