From 9f7cd5ce48f20ba604f860c00dc196df9b7f4ab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Fri, 28 Aug 2026 00:48:04 +0200 Subject: [PATCH 1/2] Name and number the GiST support functions as PostgreSQL 18 defines them PostgreSQL 18 gives GiST support function 12 to GIST_TRANSLATE_CMPTYPE_PROC, so the multi-entry extract function is support function 13. The access method reads the compare-type procedure under the name the released header publishes, and the MobilityDB and PostGIS operator classes declare their extract function in slot 13, which is the slot mgist reads it from. --- contrib/mobilitydb/mobilitydb_mest--1.0.sql | 72 ++++++++++----------- contrib/postgis/postgis_mest--1.0.sql | 2 +- src/mgist/mgistutil.c | 4 +- src/mgist/mgistvalidate.c | 6 +- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/contrib/mobilitydb/mobilitydb_mest--1.0.sql b/contrib/mobilitydb/mobilitydb_mest--1.0.sql index b198bb5..0a06751 100755 --- a/contrib/mobilitydb/mobilitydb_mest--1.0.sql +++ b/contrib/mobilitydb/mobilitydb_mest--1.0.sql @@ -124,7 +124,7 @@ CREATE OPERATOR CLASS intspanset_mrtree_equisplit_ops FUNCTION 7 span_gist_same(intspan, intspan, internal), FUNCTION 8 span_gist_distance(internal, intspan, smallint, oid, internal), FUNCTION 10 spanset_mest_span_options(internal), - FUNCTION 12 spanset_mest_equisplit(internal, internal, internal); + FUNCTION 13 spanset_mest_equisplit(internal, internal, internal); /******************************************************************************/ @@ -175,7 +175,7 @@ CREATE OPERATOR CLASS bigintspanset_mrtree_equisplit_ops FUNCTION 7 span_gist_same(bigintspan, bigintspan, internal), FUNCTION 8 span_gist_distance(internal, bigintspan, smallint, oid, internal), FUNCTION 10 spanset_mest_span_options(internal), - FUNCTION 12 spanset_mest_equisplit(internal, internal, internal); + FUNCTION 13 spanset_mest_equisplit(internal, internal, internal); /******************************************************************************/ @@ -226,7 +226,7 @@ CREATE OPERATOR CLASS floatspanset_mrtree_equisplit_ops FUNCTION 7 span_gist_same(floatspan, floatspan, internal), FUNCTION 8 span_gist_distance(internal, floatspan, smallint, oid, internal), FUNCTION 10 spanset_mest_span_options(internal), - FUNCTION 12 spanset_mest_equisplit(internal, internal, internal); + FUNCTION 13 spanset_mest_equisplit(internal, internal, internal); /******************************************************************************/ @@ -276,7 +276,7 @@ CREATE OPERATOR CLASS datespanset_mrtree_equisplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(datespan, datespan, internal), FUNCTION 10 spanset_mest_span_options(internal), - FUNCTION 12 spanset_mest_equisplit(internal, internal, internal); + FUNCTION 13 spanset_mest_equisplit(internal, internal, internal); /******************************************************************************/ @@ -326,7 +326,7 @@ CREATE OPERATOR CLASS tstzspanset_mrtree_equisplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 10 spanset_mest_span_options(internal), - FUNCTION 12 spanset_mest_equisplit(internal, internal, internal); + FUNCTION 13 spanset_mest_equisplit(internal, internal, internal); /****************************************************************************** * Segment split @@ -384,7 +384,7 @@ CREATE OPERATOR CLASS intspanset_mrtree_segsplit_ops FUNCTION 7 span_gist_same(intspan, intspan, internal), FUNCTION 8 span_gist_distance(internal, intspan, smallint, oid, internal), FUNCTION 10 spanset_mest_seg_options(internal), - FUNCTION 12 spanset_mest_segsplit(internal, internal, internal); + FUNCTION 13 spanset_mest_segsplit(internal, internal, internal); /******************************************************************************/ @@ -435,7 +435,7 @@ CREATE OPERATOR CLASS bigintspanset_mrtree_segsplit_ops FUNCTION 7 span_gist_same(bigintspan, bigintspan, internal), FUNCTION 8 span_gist_distance(internal, bigintspan, smallint, oid, internal), FUNCTION 10 spanset_mest_seg_options(internal), - FUNCTION 12 spanset_mest_segsplit(internal, internal, internal); + FUNCTION 13 spanset_mest_segsplit(internal, internal, internal); /******************************************************************************/ @@ -486,7 +486,7 @@ CREATE OPERATOR CLASS floatspanset_mrtree_segsplit_ops FUNCTION 7 span_gist_same(floatspan, floatspan, internal), FUNCTION 8 span_gist_distance(internal, floatspan, smallint, oid, internal), FUNCTION 10 spanset_mest_seg_options(internal), - FUNCTION 12 spanset_mest_segsplit(internal, internal, internal); + FUNCTION 13 spanset_mest_segsplit(internal, internal, internal); /******************************************************************************/ @@ -536,7 +536,7 @@ CREATE OPERATOR CLASS datespanset_mrtree_segsplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(datespan, datespan, internal), FUNCTION 10 spanset_mest_seg_options(internal), - FUNCTION 12 spanset_mest_segsplit(internal, internal, internal); + FUNCTION 13 spanset_mest_segsplit(internal, internal, internal); /******************************************************************************/ @@ -586,7 +586,7 @@ CREATE OPERATOR CLASS tstzspanset_mrtree_segsplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 10 spanset_mest_seg_options(internal), - FUNCTION 12 spanset_mest_segsplit(internal, internal, internal); + FUNCTION 13 spanset_mest_segsplit(internal, internal, internal); /****************************************************************************** * Binsplit @@ -656,7 +656,7 @@ CREATE OPERATOR CLASS intspanset_mrtree_binsplit_ops FUNCTION 7 span_gist_same(intspan, intspan, internal), FUNCTION 8 span_gist_distance(internal, intspan, smallint, oid, internal), FUNCTION 10 intspanset_mest_bin_options(internal), - FUNCTION 12 intspanset_mest_binsplit(internal, internal, internal); + FUNCTION 13 intspanset_mest_binsplit(internal, internal, internal); /******************************************************************************/ @@ -707,7 +707,7 @@ CREATE OPERATOR CLASS bigintspanset_mrtree_binsplit_ops FUNCTION 7 span_gist_same(bigintspan, bigintspan, internal), FUNCTION 8 span_gist_distance(internal, bigintspan, smallint, oid, internal), FUNCTION 10 intspanset_mest_bin_options(internal), - FUNCTION 12 bigintspanset_mest_binsplit(internal, internal, internal); + FUNCTION 13 bigintspanset_mest_binsplit(internal, internal, internal); /******************************************************************************/ @@ -758,7 +758,7 @@ CREATE OPERATOR CLASS floatspanset_mrtree_binsplit_ops FUNCTION 7 span_gist_same(floatspan, floatspan, internal), FUNCTION 8 span_gist_distance(internal, floatspan, smallint, oid, internal), FUNCTION 10 floatspanset_mest_bin_options(internal), - FUNCTION 12 floatspanset_mest_binsplit(internal, internal, internal); + FUNCTION 13 floatspanset_mest_binsplit(internal, internal, internal); /******************************************************************************/ @@ -808,7 +808,7 @@ CREATE OPERATOR CLASS datespanset_mrtree_binsplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(datespan, datespan, internal), FUNCTION 10 timespanset_mest_bin_options(internal), - FUNCTION 12 timespanset_mest_binsplit(internal, internal, internal); + FUNCTION 13 timespanset_mest_binsplit(internal, internal, internal); /******************************************************************************/ @@ -858,7 +858,7 @@ CREATE OPERATOR CLASS tstzspanset_mrtree_binsplit_ops FUNCTION 6 span_gist_picksplit(internal, internal), FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 10 timespanset_mest_bin_options(internal), - FUNCTION 12 timespanset_mest_binsplit(internal, internal, internal); + FUNCTION 13 timespanset_mest_binsplit(internal, internal, internal); /****************************************************************************** * Multi-Entry Quad-tree and Kd-tree SP-GiST indexes @@ -2463,7 +2463,7 @@ CREATE OPERATOR CLASS tbool_mrtree_equisplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), -- FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_span_options(internal), - FUNCTION 12 temporal_mest_equisplit(internal, internal, internal); + FUNCTION 13 temporal_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS tbool_mquadtree_equisplit_ops DEFAULT FOR TYPE tbool USING mspgist AS @@ -2568,7 +2568,7 @@ CREATE OPERATOR CLASS ttext_mrtree_equisplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_span_options(internal), - FUNCTION 12 temporal_mest_equisplit(internal, internal, internal); + FUNCTION 13 temporal_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS ttext_mquadtree_equisplit_ops DEFAULT FOR TYPE ttext USING mspgist AS @@ -2680,7 +2680,7 @@ CREATE OPERATOR CLASS tbool_mrtree_segsplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_seg_options(internal), - FUNCTION 12 temporal_mest_segsplit(internal, internal, internal); + FUNCTION 13 temporal_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS tbool_mquadtree_segsplit_ops FOR TYPE tbool USING mspgist AS @@ -2785,7 +2785,7 @@ CREATE OPERATOR CLASS ttext_mrtree_segsplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_seg_options(internal), - FUNCTION 12 temporal_mest_segsplit(internal, internal, internal); + FUNCTION 13 temporal_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS ttext_mquadtree_segsplit_ops FOR TYPE ttext USING mspgist AS @@ -2897,7 +2897,7 @@ CREATE OPERATOR CLASS tbool_mrtree_binsplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_bin_options(internal), - FUNCTION 12 temporal_mest_binsplit(internal, internal, internal); + FUNCTION 13 temporal_mest_binsplit(internal, internal, internal); CREATE OPERATOR CLASS tbool_mquadtree_binsplit_ops FOR TYPE tbool USING mspgist AS @@ -3002,7 +3002,7 @@ CREATE OPERATOR CLASS ttext_mrtree_binsplit_ops FUNCTION 7 span_gist_same(tstzspan, tstzspan, internal), FUNCTION 8 span_gist_distance(internal, tstzspan, smallint, oid, internal), FUNCTION 10 temporal_mest_bin_options(internal), - FUNCTION 12 temporal_mest_binsplit(internal, internal, internal); + FUNCTION 13 temporal_mest_binsplit(internal, internal, internal); CREATE OPERATOR CLASS ttext_mquadtree_binsplit_ops FOR TYPE ttext USING mspgist AS @@ -3164,7 +3164,7 @@ CREATE OPERATOR CLASS tint_mrtree_equisplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tnumber_mest_box_options(internal), - FUNCTION 12 tnumber_mest_equisplit(internal, internal, internal); + FUNCTION 13 tnumber_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS tint_mquadtree_equisplit_ops DEFAULT FOR TYPE tint USING mspgist AS @@ -3299,7 +3299,7 @@ CREATE OPERATOR CLASS tfloat_mrtree_equisplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tnumber_mest_box_options(internal), - FUNCTION 12 tnumber_mest_equisplit(internal, internal, internal); + FUNCTION 13 tnumber_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS tfloat_mquadtree_equisplit_ops DEFAULT FOR TYPE tfloat USING mspgist AS @@ -3441,7 +3441,7 @@ CREATE OPERATOR CLASS tint_mrtree_segsplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tnumber_mest_seg_options(internal), - FUNCTION 12 tnumber_mest_segsplit(internal, internal, internal); + FUNCTION 13 tnumber_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS tint_mquadtree_segsplit_ops FOR TYPE tint USING mspgist AS @@ -3576,7 +3576,7 @@ CREATE OPERATOR CLASS tfloat_mrtree_segsplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tnumber_mest_seg_options(internal), - FUNCTION 12 tnumber_mest_segsplit(internal, internal, internal); + FUNCTION 13 tnumber_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS tfloat_mquadtree_segsplit_ops FOR TYPE tfloat USING mspgist AS @@ -3725,7 +3725,7 @@ CREATE OPERATOR CLASS tint_mrtree_tilesplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tint_mest_tile_options(internal), - FUNCTION 12 tint_mest_tilesplit(internal, internal, internal); + FUNCTION 13 tint_mest_tilesplit(internal, internal, internal); CREATE OPERATOR CLASS tint_mquadtree_tilesplit_ops FOR TYPE tint USING mspgist AS @@ -3862,7 +3862,7 @@ CREATE OPERATOR CLASS tfloat_mrtree_tilesplit_ops FUNCTION 7 tbox_gist_same(tbox, tbox, internal), FUNCTION 8 tbox_gist_distance(internal, tbox, smallint, oid, internal), FUNCTION 10 tfloat_mest_tile_options(internal), - FUNCTION 12 tfloat_mest_tilesplit(internal, internal, internal); + FUNCTION 13 tfloat_mest_tilesplit(internal, internal, internal); CREATE OPERATOR CLASS tfloat_mquadtree_tilesplit_ops FOR TYPE tfloat USING mspgist AS @@ -4035,7 +4035,7 @@ CREATE OPERATOR CLASS tgeompoint_mrtree_equisplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_box_options(internal), - FUNCTION 12 tpoint_mest_equisplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_equisplit_ops DEFAULT FOR TYPE tgeompoint USING mspgist AS @@ -4174,7 +4174,7 @@ CREATE OPERATOR CLASS tgeogpoint_mrtree_equisplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_box_options(internal), - FUNCTION 12 tpoint_mest_equisplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_equisplit(internal, internal, internal); CREATE OPERATOR CLASS tgeogpoint_mquadtree_equisplit_ops DEFAULT FOR TYPE tgeogpoint USING mspgist AS @@ -4332,7 +4332,7 @@ CREATE OPERATOR CLASS tgeompoint_mrtree_segsplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_seg_options(internal), - FUNCTION 12 tpoint_mest_segsplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_segsplit_ops FOR TYPE tgeompoint USING mspgist AS @@ -4478,7 +4478,7 @@ CREATE OPERATOR CLASS tgeogpoint_mrtree_segsplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_seg_options(internal), - FUNCTION 12 tpoint_mest_segsplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_segsplit(internal, internal, internal); CREATE OPERATOR CLASS tgeogpoint_mquadtree_segsplit_ops FOR TYPE tgeogpoint USING mspgist AS @@ -4638,7 +4638,7 @@ CREATE OPERATOR CLASS tgeompoint_mrtree_tilesplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_tile_options(internal), - FUNCTION 12 tpoint_mest_tilesplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_tilesplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_tilesplit_ops FOR TYPE tgeompoint USING mspgist AS @@ -4783,7 +4783,7 @@ CREATE OPERATOR CLASS tgeogpoint_mrtree_tilesplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_tile_options(internal), - FUNCTION 12 tpoint_mest_tilesplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_tilesplit(internal, internal, internal); CREATE OPERATOR CLASS tgeogpoint_mquadtree_tilesplit_ops FOR TYPE tgeogpoint USING mspgist AS @@ -4964,7 +4964,7 @@ CREATE OPERATOR CLASS tgeompoint_mgist_mergesplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_box_options(internal), - FUNCTION 12 tpoint_mest_mergesplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_mergesplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_mergesplit_ops FOR TYPE tgeompoint USING mspgist AS @@ -5117,7 +5117,7 @@ CREATE OPERATOR CLASS tgeompoint_mrtree_linearsplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_query_options(internal), - FUNCTION 12 tpoint_mest_linearsplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_linearsplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_linearsplit_ops FOR TYPE tgeompoint USING mspgist AS @@ -5270,7 +5270,7 @@ CREATE OPERATOR CLASS tgeompoint_mrtree_adaptsplit_ops FUNCTION 7 stbox_gist_same(stbox, stbox, internal), FUNCTION 8 stbox_gist_distance(internal, stbox, smallint, oid, internal), FUNCTION 10 tpoint_mest_box_options(internal), - FUNCTION 12 tpoint_mest_adaptsplit(internal, internal, internal); + FUNCTION 13 tpoint_mest_adaptsplit(internal, internal, internal); CREATE OPERATOR CLASS tgeompoint_mquadtree_adaptsplit_ops FOR TYPE tgeompoint USING mspgist AS diff --git a/contrib/postgis/postgis_mest--1.0.sql b/contrib/postgis/postgis_mest--1.0.sql index e8ad73e..ac1e534 100755 --- a/contrib/postgis/postgis_mest--1.0.sql +++ b/contrib/postgis/postgis_mest--1.0.sql @@ -26,6 +26,6 @@ CREATE OPERATOR CLASS geometry_mgist_ops_2d FUNCTION 5 geometry_gist_penalty_2d (internal, internal, internal), FUNCTION 6 geometry_gist_picksplit_2d (internal, internal), FUNCTION 7 geometry_gist_same_2d (geom1 geometry, geom2 geometry, internal), - FUNCTION 12 geometry_mest_extract(internal, internal, internal); + FUNCTION 13 geometry_mest_extract(internal, internal, internal); /******************************************************************************/ diff --git a/src/mgist/mgistutil.c b/src/mgist/mgistutil.c index 5f63885..2419759 100644 --- a/src/mgist/mgistutil.c +++ b/src/mgist/mgistutil.c @@ -1092,7 +1092,7 @@ gist_stratnum_common(PG_FUNCTION_ARGS) /* * Returns the opclass's private stratnum used for the given compare type. * - * Calls the opclass's GIST_STRATNUM_PROC support function, if any, + * Calls the opclass's GIST_TRANSLATE_CMPTYPE_PROC support function, if any, * and returns the result. * Returns InvalidStrategy if the function is not defined. */ @@ -1103,7 +1103,7 @@ gisttranslatecmptype(CompareType cmptype, Oid opfamily) Datum result; /* Check whether the function is provided. */ - funcid = get_opfamily_proc(opfamily, ANYOID, ANYOID, GIST_STRATNUM_PROC); + funcid = get_opfamily_proc(opfamily, ANYOID, ANYOID, GIST_TRANSLATE_CMPTYPE_PROC); if (!OidIsValid(funcid)) return InvalidStrategy; diff --git a/src/mgist/mgistvalidate.c b/src/mgist/mgistvalidate.c index 88824e4..8953ac9 100644 --- a/src/mgist/mgistvalidate.c +++ b/src/mgist/mgistvalidate.c @@ -139,7 +139,7 @@ mgistvalidate(Oid opclassoid) ok = check_amproc_signature(procform->amproc, VOIDOID, true, 1, 1, INTERNALOID); break; - case GIST_STRATNUM_PROC: + case GIST_TRANSLATE_CMPTYPE_PROC: ok = check_amproc_signature(procform->amproc, INT2OID, true, 1, 1, INT4OID) && procform->amproclefttype == ANYOID && @@ -271,7 +271,7 @@ mgistvalidate(Oid opclassoid) if (i == GIST_DISTANCE_PROC || i == GIST_FETCH_PROC || i == GIST_COMPRESS_PROC || i == GIST_DECOMPRESS_PROC || i == GIST_OPTIONS_PROC || i == GIST_SORTSUPPORT_PROC || - i == GIST_STRATNUM_PROC) + i == GIST_TRANSLATE_CMPTYPE_PROC) continue; /* optional methods */ ereport(INFO, (errcode(ERRCODE_INVALID_OBJECT_DEFINITION), @@ -343,7 +343,7 @@ mgistadjustmembers(Oid opfamilyoid, case GIST_FETCH_PROC: case GIST_OPTIONS_PROC: case GIST_SORTSUPPORT_PROC: - case GIST_STRATNUM_PROC: + case GIST_TRANSLATE_CMPTYPE_PROC: /* Optional, so force it to be a soft family dependency */ op->ref_is_hard = false; op->ref_is_family = true; From d9a66d46a3e875ec6c2598f14f1b2baf55ddbc18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20Zim=C3=A1nyi?= Date: Fri, 28 Aug 2026 00:48:18 +0200 Subject: [PATCH 2/2] State the MobilityDB contrib against the MobilityDB 1.4 API The catalog type is MeosType and its accessors are meostype_oid and oid_meostype; span_spgist_get_span takes the query datum and its MEOS type; the span predicates are overlaps_span_span, adjacent_span_span, left_span_span, overleft_span_span, right_span_span and overright_span_span; the span distance is distance_double of distance_span_span in the base type of the key; the bins of a span set and of the time of a temporal value come from spanset_bins and temporal_time_bins; and a temporal geo answers its box with tspatial_to_stbox, its splits with tgeo_split_n_stboxes and tgeo_split_each_n_stboxes, and its tiles with tgeo_space_time_boxes over a geom_in origin. The origin of the time bins is a value of the base type of the span set, a date for a date span set and a timestamptz otherwise, read through the PostgreSQL input function of that type. The duration parameter reaches interval_in through DirectFunctionCall3, which is the arity of a PostgreSQL input function, and a time bin split states that the operator class requires a duration rather than reaching spanset_bins without one. Two spans that share a boundary value are adjacent whatever their bound inclusivity, so an adjacent pair may also overlap and a single entry of a multi-entry key is neither strictly left nor strictly right of the query. The leaf consistent method answers adjacency with the same conservative test the inner one already uses. The tiling declarations MobilityDB no longer publishes are gone, and each translation unit includes the PostgreSQL random-generator header that the installed MEOS internal header needs. --- contrib/mobilitydb/mobilitydb_mest.h | 92 ++++++++++++---------------- contrib/mobilitydb/spanset_mest.c | 79 ++++++++++++++++-------- contrib/mobilitydb/temporal_mest.c | 10 +-- contrib/mobilitydb/tnumber_mest.c | 15 +++-- contrib/mobilitydb/tpoint_mest.c | 48 ++++++++------- 5 files changed, 133 insertions(+), 111 deletions(-) diff --git a/contrib/mobilitydb/mobilitydb_mest.h b/contrib/mobilitydb/mobilitydb_mest.h index 568e24c..8bb6718 100644 --- a/contrib/mobilitydb/mobilitydb_mest.h +++ b/contrib/mobilitydb/mobilitydb_mest.h @@ -59,6 +59,9 @@ #define BORDER_INC true #define BORDER_EXC false +/** Origin the time bins and the time dimension of the tiles are anchored at */ +#define MEST_TIME_ORIGIN "2020-03-01" + /*****************************************************************************/ /** Enumeration for the types of SP-GiST indexes */ @@ -78,66 +81,30 @@ typedef struct Span right; } SpanNode; -#define MAXDIMS 4 - -/** - * Structure for storing a bit matrix - */ -typedef struct -{ - int ndims; /**< Number of dimensions */ - int count[MAXDIMS]; /**< Number of elements in each dimension */ - uint8_t byte[1]; /**< beginning of variable-length data */ -} BitMatrix; - -/** - * Struct for storing the state that persists across multiple calls generating - * a multidimensional grid - */ -typedef struct STboxGridState -{ - bool done; /**< True when all tiles have been processed */ - bool hasz; /**< True when tiles have Z dimension */ - bool hast; /**< True when tiles have T dimension */ - int i; /**< Number of current tile */ - double xsize; /**< Size of the x dimension */ - double ysize; /**< Size of the y dimension */ - double zsize; /**< Size of the z dimension, 0 for 2D */ - int64 tunits; /**< Size of the time dimension, 0 for spatial only */ - STBox box; /**< Bounding box of the grid */ - const Temporal *temp; /**< Optional temporal point to be split */ - BitMatrix *bm; /**< Optional bit matrix for speeding up the - computation of the split functions */ - double x; /**< Minimum x value of the current tile */ - double y; /**< Minimum y value of the current tile */ - double z; /**< Minimum z value of the current tile, if any */ - TimestampTz t; /**< Minimum t value of the current tile, if any */ - int ntiles; /**< Total number of tiles */ - int max_coords[MAXDIMS]; /**< Maximum coordinates of the tiles */ - int coords[MAXDIMS]; /**< Coordinates of the current tile */ -} STboxGridState; - /***************************************************************************** * External functions from MobilityDB *****************************************************************************/ extern bool ensure_not_null(const void *ptr); extern bool ensure_positive(int i); -extern Oid type_oid(meosType t); +extern Oid meostype_oid(MeosType type); extern ArrayType *stboxarr_to_array(STBox *boxes, int count); -extern Datum call_function1(PGFunction func, Datum arg1); -extern Datum call_function2(PGFunction func, Datum arg1, Datum arg2); +extern Datum date_in(PG_FUNCTION_ARGS); extern Datum interval_in(PG_FUNCTION_ARGS); +extern Datum timestamptz_in(PG_FUNCTION_ARGS); extern void spanset_span_slice(Datum d, Span *s); extern Temporal *temporal_slice(Datum tempdatum); -extern meosType oid_type(Oid typid); -extern void spannode_init(SpanNode *nodebox, meosType spantype, - meosType basetype); +extern MeosType oid_meostype(Oid typid); +extern void spannode_init(SpanNode *nodebox, MeosType spantype, + MeosType basetype); extern bool span_gist_get_span(FunctionCallInfo fcinfo, Span *result, Oid typid); -extern bool span_spgist_get_span(const ScanKeyData *scankey, Span *result); +extern bool span_spgist_get_span(Datum value, MeosType type, + Span *result); extern SpanNode *spannode_copy(const SpanNode *orig); -extern double distance_span_nodespan(Span *query, SpanNode *nodebox); +extern double distance_span_nodespan(const Span *query, + const SpanNode *nodebox); +extern double distance_double(Datum dist, MeosType type); extern void spannode_quadtree_next(const SpanNode *nodebox, const Span *centroid, uint8 quadrant, SpanNode *next_nodespan); extern void spannode_kdtree_next(const SpanNode *nodebox, const Span *centroid, @@ -149,11 +116,30 @@ extern bool overLeft2D(const SpanNode *nodebox, const Span *query); extern bool right2D(const SpanNode *nodebox, const Span *query); extern bool overRight2D(const SpanNode *nodebox, const Span *query); extern bool adjacent2D(const SpanNode *nodebox, const Span *query); -extern void stbox_tile_state_next(STboxGridState *state); -extern bool stbox_tile_state_get(STboxGridState *state, STBox *box); -extern STboxGridState *tpoint_space_time_tile_init(const Temporal *temp, - float xsize, float ysize, float zsize, const Interval *duration, - const GSERIALIZED *sorigin, TimestampTz torigin, bool bitmatrix, - bool border_inc, int *ntiles); + +/***************************************************************************** + * Origin of the time bins and of the time dimension of the tiles + *****************************************************************************/ + +/** + * @brief Return the origin of the time dimension as a date + */ +static inline DateADT +mest_date_origin(void) +{ + return DatumGetDateADT(DirectFunctionCall1(date_in, + CStringGetDatum(MEST_TIME_ORIGIN))); +} + +/** + * @brief Return the origin of the time dimension as a timestamptz + */ +static inline TimestampTz +mest_timestamptz_origin(void) +{ + return DatumGetTimestampTz(DirectFunctionCall3(timestamptz_in, + CStringGetDatum(MEST_TIME_ORIGIN), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); +} /*****************************************************************************/ diff --git a/contrib/mobilitydb/spanset_mest.c b/contrib/mobilitydb/spanset_mest.c index b83a644..2b18507 100755 --- a/contrib/mobilitydb/spanset_mest.c +++ b/contrib/mobilitydb/spanset_mest.c @@ -10,6 +10,7 @@ #include #include "postgres.h" +#include "common/pg_prng.h" #include "fmgr.h" #include "access/gist.h" #include "access/spgist.h" @@ -282,7 +283,7 @@ Intspanset_mest_binsplit(PG_FUNCTION_ARGS) int32 vsize = MEST_INTSPANSET_GET_BINSIZE(); int32 vorigin = 0; int32 count; - Span *spans= spanset_value_spans(ss, Int32GetDatum(vsize), + Span *spans = spanset_bins(ss, Int32GetDatum(vsize), Int32GetDatum(vorigin), &count); Datum *keys = palloc(sizeof(Datum) * count); for (int i = 0; i < count; ++i) @@ -304,7 +305,7 @@ Bigintspanset_mest_binsplit(PG_FUNCTION_ARGS) int64 vsize = (int64) MEST_INTSPANSET_GET_BINSIZE(); int64 vorigin = 0; int32 count; - Span *spans= spanset_value_spans(ss, Int64GetDatum(vsize), + Span *spans = spanset_bins(ss, Int64GetDatum(vsize), Int64GetDatum(vorigin), &count); Datum *keys = palloc(sizeof(Datum) * count); for (int i = 0; i < count; ++i) @@ -326,7 +327,7 @@ Floatspanset_mest_binsplit(PG_FUNCTION_ARGS) double vsize = MEST_FLOATSPANSET_GET_BINSIZE(); double vorigin = 0; int32 count; - Span *spans= spanset_value_spans(ss, Float8GetDatum(vsize), + Span *spans = spanset_bins(ss, Float8GetDatum(vsize), Float8GetDatum(vorigin), &count); Datum *keys = palloc(sizeof(Datum) * count); for (int i = 0; i < count; ++i) @@ -349,11 +350,16 @@ Timespanset_mest_binsplit(PG_FUNCTION_ARGS) int32 *nkeys = (int32 *) PG_GETARG_POINTER(1); char *duration; Interval *interv = NULL; - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + Datum torigin; int32 count; Span *spanarr; Span **spans; - + + /* The origin is a value of the base type of the span set */ + torigin = (ss->basetype == T_DATE) ? + DateADTGetDatum(mest_date_origin()) : + TimestampTzGetDatum(mest_timestamptz_origin()); + /* Index parameters */ if (PG_HAS_OPCLASS_OPTIONS()) { @@ -361,8 +367,9 @@ Timespanset_mest_binsplit(PG_FUNCTION_ARGS) duration = GET_STRING_RELOPTION(options, duration); if (strlen(duration) > 0) { - interv = (Interval *) DatumGetPointer(call_function2(interval_in, - PointerGetDatum(duration), -1)); + interv = DatumGetIntervalP(DirectFunctionCall3(interval_in, + CStringGetDatum(duration), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); if (! interv) { ereport(ERROR, @@ -371,9 +378,13 @@ Timespanset_mest_binsplit(PG_FUNCTION_ARGS) } } } + if (! interv) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("the operator class requires a duration parameter"))); /* Get the spans */ - spanarr = spanset_time_spans(ss, interv, torigin, &count); + spanarr = spanset_bins(ss, PointerGetDatum(interv), torigin, &count); spans = palloc(sizeof(Span *) * count); for (int i = 0; i < count; i++) spans[i] = &spanarr[i]; @@ -420,21 +431,24 @@ span_mest_leaf_consistent(const Span *key, const Span *query, case RTContainedByStrategyNumber: case RTEqualStrategyNumber: case RTSameStrategyNumber: - return over_span_span(key, query); + return overlaps_span_span(key, query); case RTAdjacentStrategyNumber: - return lf_span_span(key, query) || ri_span_span(key, query); + /* Two spans sharing a boundary value are adjacent whatever their bound + * inclusivity, so an adjacent pair may also overlap and a single entry + * of a multi-entry key is neither strictly left nor strictly right */ + return adjacent_span_span(key, query) || overlaps_span_span(key, query); case RTLeftStrategyNumber: case RTBeforeStrategyNumber: - return lf_span_span(key, query); + return left_span_span(key, query); case RTOverLeftStrategyNumber: case RTOverBeforeStrategyNumber: - return ovlf_span_span(key, query); + return overleft_span_span(key, query); case RTRightStrategyNumber: case RTAfterStrategyNumber: - return ri_span_span(key, query); + return right_span_span(key, query); case RTOverRightStrategyNumber: case RTOverAfterStrategyNumber: - return ovri_span_span(key, query); + return overright_span_span(key, query); default: elog(ERROR, "unrecognized span strategy: %d", strategy); return false; /* keep compiler quiet */ @@ -458,21 +472,21 @@ span_mgist_inner_consistent(const Span *key, const Span *query, case RTContainsStrategyNumber: case RTEqualStrategyNumber: case RTSameStrategyNumber: - return over_span_span(key, query); + return overlaps_span_span(key, query); case RTAdjacentStrategyNumber: - return adj_span_span(key, query) || overlaps_span_span(key, query); + return adjacent_span_span(key, query) || overlaps_span_span(key, query); case RTLeftStrategyNumber: case RTBeforeStrategyNumber: - return ! ovri_span_span(key, query); + return ! overright_span_span(key, query); case RTOverLeftStrategyNumber: case RTOverBeforeStrategyNumber: - return ! ri_span_span(key, query); + return ! right_span_span(key, query); case RTRightStrategyNumber: case RTAfterStrategyNumber: - return ! ovlf_span_span(key, query); + return ! overleft_span_span(key, query); case RTOverRightStrategyNumber: case RTOverAfterStrategyNumber: - return ! lf_span_span(key, query); + return ! left_span_span(key, query); default: elog(ERROR, "unrecognized span strategy: %d", strategy); return false; /* keep compiler quiet */ @@ -575,7 +589,11 @@ Spanset_mspgist_inner_consistent(FunctionCallInfo fcinfo, { orderbys = palloc0(sizeof(Span) * in->norderbys); for (i = 0; i < in->norderbys; i++) - span_spgist_get_span(&in->orderbys[i], &orderbys[i]); + { + const ScanKeyData *scankey = &in->orderbys[i]; + span_spgist_get_span(scankey->sk_argument, + oid_meostype(scankey->sk_subtype), &orderbys[i]); + } } if (in->allTheSame) @@ -617,7 +635,11 @@ Spanset_mspgist_inner_consistent(FunctionCallInfo fcinfo, { queries = palloc0(sizeof(Span) * in->nkeys); for (i = 0; i < in->nkeys; i++) - span_spgist_get_span(&in->scankeys[i], &queries[i]); + { + const ScanKeyData *scankey = &in->scankeys[i]; + span_spgist_get_span(scankey->sk_argument, + oid_meostype(scankey->sk_subtype), &queries[i]); + } } /* Allocate enough memory for nodes */ @@ -763,13 +785,15 @@ Spanset_mspgist_leaf_consistent(PG_FUNCTION_ARGS) /* Perform the required comparison(s) */ for (i = 0; i < in->nkeys; i++) { - StrategyNumber strategy = in->scankeys[i].sk_strategy; + const ScanKeyData *scankey = &in->scankeys[i]; + StrategyNumber strategy = scankey->sk_strategy; /* Update the recheck flag according to the strategy */ out->recheck = true; /* Convert the query to a span and perform the test */ - span_spgist_get_span(&in->scankeys[i], &span); + span_spgist_get_span(scankey->sk_argument, + oid_meostype(scankey->sk_subtype), &span); result = span_mest_leaf_consistent(key, &span, strategy); /* If any check is failed, we have found our answer. */ @@ -786,8 +810,11 @@ Spanset_mspgist_leaf_consistent(PG_FUNCTION_ARGS) for (i = 0; i < in->norderbys; i++) { /* Convert the order by argument to a span and perform the test */ - span_spgist_get_span(&in->orderbys[i], &span); - distances[i] = dist_span_span(&span, key); + const ScanKeyData *scankey = &in->orderbys[i]; + span_spgist_get_span(scankey->sk_argument, + oid_meostype(scankey->sk_subtype), &span); + distances[i] = distance_double(distance_span_span(&span, key), + key->basetype); } } diff --git a/contrib/mobilitydb/temporal_mest.c b/contrib/mobilitydb/temporal_mest.c index 5d1da7e..28a63d1 100644 --- a/contrib/mobilitydb/temporal_mest.c +++ b/contrib/mobilitydb/temporal_mest.c @@ -10,6 +10,7 @@ #include #include "postgres.h" +#include "common/pg_prng.h" #include "fmgr.h" #include "access/gist.h" #include "access/spgist.h" @@ -223,7 +224,7 @@ Temporal_mest_binsplit(PG_FUNCTION_ARGS) // bool **nullFlags = (bool **) PG_GETARG_POINTER(2); char *duration; Interval *interv = NULL; - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = mest_timestamptz_origin(); int32 count; Span *spans; Datum *keys; @@ -235,8 +236,9 @@ Temporal_mest_binsplit(PG_FUNCTION_ARGS) duration = GET_STRING_RELOPTION(options, duration); if (strlen(duration) > 0) { - interv = (Interval *) DatumGetPointer(call_function2(interval_in, - PointerGetDatum(duration), -1)); + interv = DatumGetIntervalP(DirectFunctionCall3(interval_in, + CStringGetDatum(duration), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); if (! interv) { ereport(ERROR, @@ -247,7 +249,7 @@ Temporal_mest_binsplit(PG_FUNCTION_ARGS) } /* Get the spans */ - spans = temporal_time_spans(temp, interv, torigin, &count); + spans = temporal_time_bins(temp, interv, torigin, &count); keys = palloc(sizeof(Datum) * count); assert(temp); for (int i = 0; i < count; ++i) diff --git a/contrib/mobilitydb/tnumber_mest.c b/contrib/mobilitydb/tnumber_mest.c index 03a4506..2ba50a4 100644 --- a/contrib/mobilitydb/tnumber_mest.c +++ b/contrib/mobilitydb/tnumber_mest.c @@ -10,6 +10,7 @@ #include #include "postgres.h" +#include "common/pg_prng.h" #include "fmgr.h" #include "access/gist.h" #include "access/spgist.h" @@ -276,7 +277,7 @@ Tint_mest_tilesplit(PG_FUNCTION_ARGS) int vsize, vorigin = 0; char *duration; Interval *interv = NULL; - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = mest_timestamptz_origin(); int32 count; TBox *boxes; Datum *keys; @@ -289,8 +290,9 @@ Tint_mest_tilesplit(PG_FUNCTION_ARGS) duration = GET_STRING_RELOPTION(options, duration); if (strlen(duration) > 0) { - interv = (Interval *) DatumGetPointer(call_function2(interval_in, - PointerGetDatum(duration), -1)); + interv = DatumGetIntervalP(DirectFunctionCall3(interval_in, + CStringGetDatum(duration), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); if (! interv) { ereport(ERROR, @@ -324,7 +326,7 @@ Tfloat_mest_tilesplit(PG_FUNCTION_ARGS) double vsize, vorigin = 0.0; char *duration; Interval *interv = NULL; - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + TimestampTz torigin = mest_timestamptz_origin(); int32 count; TBox *boxes; Datum *keys; @@ -337,8 +339,9 @@ Tfloat_mest_tilesplit(PG_FUNCTION_ARGS) duration = GET_STRING_RELOPTION(options, duration); if (strlen(duration) > 0) { - interv = (Interval *) DatumGetPointer(call_function2(interval_in, - PointerGetDatum(duration), -1)); + interv = DatumGetIntervalP(DirectFunctionCall3(interval_in, + CStringGetDatum(duration), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); if (! interv) { ereport(ERROR, diff --git a/contrib/mobilitydb/tpoint_mest.c b/contrib/mobilitydb/tpoint_mest.c index 7f7eef5..bd935c2 100644 --- a/contrib/mobilitydb/tpoint_mest.c +++ b/contrib/mobilitydb/tpoint_mest.c @@ -10,6 +10,7 @@ #include #include "postgres.h" +#include "common/pg_prng.h" #include "fmgr.h" #include "access/gist.h" #include "access/spgist.h" @@ -20,7 +21,9 @@ #include "utils/timestamp.h" #include +#include #include +#include #include #include "mobilitydb_mest.h" @@ -213,7 +216,7 @@ Tpoint_mest_equisplit(PG_FUNCTION_ARGS) Temporal *temp = PG_GETARG_TEMPORAL_P(0); int32 *nkeys = (int32 *) PG_GETARG_POINTER(1); int32 num_boxes = MEST_TPOINT_GET_BOXES(); - STBox *boxes = tpoint_split_n_stboxes(temp, num_boxes, nkeys); + STBox *boxes = tgeo_split_n_stboxes(temp, num_boxes, nkeys); Datum *keys = palloc(sizeof(Datum) * (*nkeys)); for (int i = 0; i < *nkeys; ++i) keys[i] = PointerGetDatum(&boxes[i]); @@ -231,7 +234,7 @@ Tpoint_mest_segsplit(PG_FUNCTION_ARGS) Temporal *temp = PG_GETARG_TEMPORAL_P(0); int32 *nkeys = (int32 *) PG_GETARG_POINTER(1); int segs_per_box = MEST_TPOINT_GET_SEGS(); - STBox *boxes = tpoint_split_each_n_stboxes(temp, segs_per_box, nkeys); + STBox *boxes = tgeo_split_each_n_stboxes(temp, segs_per_box, nkeys); Datum *keys = palloc(sizeof(Datum) * (*nkeys)); for (int i = 0; i < *nkeys; ++i) keys[i] = PointerGetDatum(&boxes[i]); @@ -254,8 +257,8 @@ Tpoint_mest_tilesplit(PG_FUNCTION_ARGS) double xsize, ysize, zsize; char *duration; Interval *interv = NULL; - GSERIALIZED *sorigin = pgis_geometry_in("Point(0 0 0)", -1); - TimestampTz torigin = pg_timestamptz_in("2020-03-01", -1); + GSERIALIZED *sorigin = geom_in("Point(0 0 0)", -1); + TimestampTz torigin = mest_timestamptz_origin(); int32 count; STBox *boxes; Datum *keys; @@ -274,8 +277,9 @@ Tpoint_mest_tilesplit(PG_FUNCTION_ARGS) duration = GET_STRING_RELOPTION(options, duration); if (strlen(duration) > 0) { - interv = (Interval *) DatumGetPointer(call_function2(interval_in, - PointerGetDatum(duration), -1)); + interv = DatumGetIntervalP(DirectFunctionCall3(interval_in, + CStringGetDatum(duration), ObjectIdGetDatum(InvalidOid), + Int32GetDatum(-1))); if (! interv) { ereport(ERROR, @@ -286,7 +290,7 @@ Tpoint_mest_tilesplit(PG_FUNCTION_ARGS) } /* Get the tiles */ - boxes = tpoint_space_time_boxes(temp, xsize, ysize, zsize, interv, sorigin, + boxes = tgeo_space_time_boxes(temp, xsize, ysize, zsize, interv, sorigin, torigin, true, true, &count); keys = palloc(sizeof(Datum) * count); assert(temp); @@ -542,7 +546,7 @@ tpointseq_mergesplit(const TSequence *seq, int32 max_count, int32 *nkeys) if (seq->count == 1 || max_count == 1) { *nkeys = 1; - return tpoint_to_stbox((const Temporal *) seq); + return tspatial_to_stbox((const Temporal *) seq); } boxes = palloc(sizeof(STBox) * seq->count); @@ -641,13 +645,13 @@ Tpoint_mergesplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); break; case TSEQUENCE: boxes = tpointseq_mergesplit((TSequence *) temp, max_count, &nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); } result = stboxarr_to_array(boxes, nkeys); pfree(boxes); @@ -672,14 +676,14 @@ Tpoint_mest_mergesplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; break; case TSEQUENCE: boxes = tpointseq_mergesplit((TSequence *) temp, max_count, nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; } keys = palloc(sizeof(Datum) * (*nkeys)); @@ -814,7 +818,7 @@ tpointseq_linearsplit(const TSequence *seq, double qx, double qy, double qt, if (seq->count == 1) { *nkeys = 1; - return tpoint_to_stbox((const Temporal *) seq); + return tspatial_to_stbox((const Temporal *) seq); } boxes = palloc(sizeof(STBox)*(seq->count - 1)); @@ -880,13 +884,13 @@ Tpoint_linearsplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); break; case TSEQUENCE: boxes = tpointseq_linearsplit((TSequence *) temp, qx, qy, qt, &nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); } result = stboxarr_to_array(boxes, nkeys); pfree(boxes); @@ -913,14 +917,14 @@ Tpoint_mest_linearsplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; break; case TSEQUENCE: boxes = tpointseq_linearsplit((TSequence *) temp, qx, qy, qt, nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; } keys = palloc(sizeof(Datum) * (*nkeys)); @@ -949,7 +953,7 @@ tpointseq_adaptsplit(const TSequence *seq, int32 segs_per_box, int32 *nkeys) if (max_count <= 1) { * nkeys = 1; - return tpoint_to_stbox((const Temporal *) seq); + return tspatial_to_stbox((const Temporal *) seq); } boxes = palloc(sizeof(STBox) * seq->count); @@ -1048,13 +1052,13 @@ Tpoint_adaptsplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); break; case TSEQUENCE: boxes = tpointseq_adaptsplit((TSequence *) temp, segs_per_box, &nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); } result = stboxarr_to_array(boxes, nkeys); pfree(boxes); @@ -1079,14 +1083,14 @@ Tpoint_mest_adaptsplit(PG_FUNCTION_ARGS) switch (temp->subtype) { case TINSTANT: - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; break; case TSEQUENCE: boxes = tpointseq_adaptsplit((TSequence *) temp, segs_per_box, nkeys); break; default: /* TSEQUENCESET */ - boxes = tpoint_to_stbox(temp); + boxes = tspatial_to_stbox(temp); *nkeys = 1; } keys = palloc(sizeof(Datum) * (*nkeys));