mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-24 00:52:40 +00:00
#3132, KNN box-only operator <-> for geography to support PgSQL < 9.5
git-svn-id: http://svn.osgeo.org/postgis/trunk@13605 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
318d910cba
commit
ea2439195b
|
@ -247,8 +247,6 @@ CREATE OPERATOR && (
|
|||
JOIN = gserialized_gist_joinsel_nd
|
||||
);
|
||||
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
|
||||
-- Availability: 2.2.0
|
||||
CREATE OR REPLACE FUNCTION geography_distance_knn(geography, geography)
|
||||
RETURNS float8
|
||||
|
@ -268,7 +266,6 @@ CREATE OR REPLACE FUNCTION geography_gist_distance(internal, geography, int4)
|
|||
AS 'MODULE_PATHNAME' ,'gserialized_gist_geog_distance'
|
||||
LANGUAGE 'c';
|
||||
|
||||
#endif
|
||||
|
||||
-- Availability: 1.5.0
|
||||
CREATE OPERATOR CLASS gist_geography_ops
|
||||
|
@ -278,11 +275,9 @@ CREATE OPERATOR CLASS gist_geography_ops
|
|||
-- OPERATOR 6 ~= ,
|
||||
-- OPERATOR 7 ~ ,
|
||||
-- OPERATOR 8 @ ,
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
-- Availability: 2.2.0
|
||||
OPERATOR 13 <-> FOR ORDER BY pg_catalog.float_ops,
|
||||
FUNCTION 8 geography_gist_distance (internal, geography, int4),
|
||||
#endif
|
||||
FUNCTION 1 geography_gist_consistent (internal, geography, int4),
|
||||
FUNCTION 2 geography_gist_union (bytea, internal),
|
||||
FUNCTION 3 geography_gist_compress (internal),
|
||||
|
|
|
@ -61,7 +61,7 @@ Datum geography_distance_knn(PG_FUNCTION_ARGS)
|
|||
GSERIALIZED *g2 = NULL;
|
||||
double distance;
|
||||
double tolerance = FP_TOLERANCE;
|
||||
bool use_spheroid = false; /**switched back to use sphere, can get index to harmonize with sphoeroid **/
|
||||
bool use_spheroid = false; /** switched back to use sphere, can't get index to harmonize with sphoeroid **/
|
||||
SPHEROID s;
|
||||
|
||||
/* Get our geometry objects loaded into memory. */
|
||||
|
|
|
@ -78,9 +78,7 @@ Datum gserialized_gist_picksplit(PG_FUNCTION_ARGS);
|
|||
Datum gserialized_gist_union(PG_FUNCTION_ARGS);
|
||||
Datum gserialized_gist_same(PG_FUNCTION_ARGS);
|
||||
Datum gserialized_gist_distance(PG_FUNCTION_ARGS);
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
Datum gserialized_gist_geog_distance(PG_FUNCTION_ARGS);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** ND Operator prototypes
|
||||
|
@ -1048,7 +1046,6 @@ Datum gserialized_gist_same(PG_FUNCTION_ARGS)
|
|||
|
||||
|
||||
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
|
||||
PG_FUNCTION_INFO_V1(gserialized_gist_geog_distance);
|
||||
Datum gserialized_gist_geog_distance(PG_FUNCTION_ARGS)
|
||||
|
@ -1056,7 +1053,9 @@ Datum gserialized_gist_geog_distance(PG_FUNCTION_ARGS)
|
|||
GISTENTRY *entry = (GISTENTRY*) PG_GETARG_POINTER(0);
|
||||
Datum query_datum = PG_GETARG_DATUM(1);
|
||||
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
bool *recheck = (bool *) PG_GETARG_POINTER(4);
|
||||
#endif
|
||||
char query_box_mem[GIDX_MAX_SIZE];
|
||||
GIDX *query_box = (GIDX*)query_box_mem;
|
||||
GIDX *entry_box;
|
||||
|
@ -1078,11 +1077,13 @@ Datum gserialized_gist_geog_distance(PG_FUNCTION_ARGS)
|
|||
PG_RETURN_FLOAT8(FLT_MAX);
|
||||
}
|
||||
|
||||
#if POSTGIS_PGSQL_VERSION >= 95
|
||||
/* When we hit leaf nodes, it's time to turn on recheck */
|
||||
if (GIST_LEAF(entry))
|
||||
{
|
||||
*recheck = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Get the entry box */
|
||||
entry_box = (GIDX*)DatumGetPointer(entry->key);
|
||||
|
@ -1097,7 +1098,6 @@ Datum gserialized_gist_geog_distance(PG_FUNCTION_ARGS)
|
|||
|
||||
PG_RETURN_FLOAT8(distance);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue