]> granicus.if.org Git - postgis/commitdiff
#3132, KNN box-only operator <-> for geography to support PgSQL < 9.5
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 3 Jun 2015 17:05:12 +0000 (17:05 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 3 Jun 2015 17:05:12 +0000 (17:05 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13605 b70326c6-7e19-0410-871a-916f4a2858ee

postgis/geography.sql.in
postgis/geography_measurement.c
postgis/gserialized_gist_nd.c

index 092de843a5e369f2c0bcbf3811910660e93f18a0..b8ac6807f0476ca34af5079dde722a1c33040cb9 100644 (file)
@@ -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),
index d77cd0764ea98873738e90a7f7db190279c85ebb..edb240a4def707bbf23f1b73b485f7b1a125b516 100644 (file)
@@ -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. */
index c2d7c0575ef64c8d62d5b0438dbb6179cf9d5b42..8be385ee234d6049fdeea2a9a0f631d90e75d3ac 100644 (file)
@@ -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
 
 
 /*