]> granicus.if.org Git - postgis/commitdiff
Update PostGIS SVN trunk to use the new 8.4 GiST API (where RECHECK is now specified...
authorMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Thu, 21 Aug 2008 10:56:10 +0000 (10:56 +0000)
committerMark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Thu, 21 Aug 2008 10:56:10 +0000 (10:56 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@2919 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_gist.c
lwgeom/lwpostgis.sql.in.c

index 6879c606142b5da128c729fb8f03dd47cae0ac14..75906c122126138d1bab7b41da0e61e2ffa18cc2 100644 (file)
@@ -546,6 +546,16 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
        bool result;
        BOX2DFLOAT4  box;
 
+#if POSTGIS_PGSQL_VERSION >= 84
+       /* PostgreSQL 8.4 and later require the RECHECK flag to be set here,
+          rather than being supplied as part of the operator class definition */
+       bool *recheck = (bool *) PG_GETARG_POINTER(4);
+
+       /* Since the index is lossy from conversion from float8 to float4, we must
+          recheck */
+       *recheck = true;
+#endif
+
        POSTGIS_DEBUG(2, "GIST: LWGEOM_gist_consistent called");
 
        if ( ((Pointer *) PG_GETARG_DATUM(1)) == NULL )
index e21c039ca6c35c4759ccf2bbe46ee076f03f1c39..19e5e3c28ca8edfb21117796939e9d1157aa1f0e 100644 (file)
@@ -991,8 +991,10 @@ CREATEFUNCTION LWGEOM_gist_decompress(internal)
 -- GIST opclass index binding entries.
 -------------------------------------------
 
+#if POSTGIS_PGSQL_VERSION < 84
+
 --
--- Create opclass index bindings for PG>=73
+-- Create opclass index bindings for PG>=73 and PG<=83
 --
 
 CREATE OPERATOR CLASS gist_geometry_ops
@@ -1018,7 +1020,37 @@ CREATE OPERATOR CLASS gist_geometry_ops
         FUNCTION        6        LWGEOM_gist_picksplit (internal, internal),
         FUNCTION        7        LWGEOM_gist_same (box2d, box2d, internal);
 
--- TODO: add btree binding...
+#else
+
+--
+-- Create opclass index bindings for PG>83 
+-- (No RECHECK since this is now handled as part of the GiST Access methods)
+--
+
+CREATE OPERATOR CLASS gist_geometry_ops
+        DEFAULT FOR TYPE geometry USING gist AS
+       STORAGE         box2d,
+        OPERATOR        1        <<,
+        OPERATOR        2        &<,
+        OPERATOR        3        &&,
+        OPERATOR        4        &>,
+        OPERATOR        5        >>,
+        OPERATOR        6        ~=,
+        OPERATOR        7        ~,
+        OPERATOR        8        @,
+       OPERATOR        9        &<|,
+       OPERATOR        10       <<|,
+       OPERATOR        11       |>>,
+       OPERATOR        12       |&>,
+       FUNCTION        1        LWGEOM_gist_consistent (internal, geometry, int4),
+        FUNCTION        2        LWGEOM_gist_union (bytea, internal),
+        FUNCTION        3        LWGEOM_gist_compress (internal),
+        FUNCTION        4        LWGEOM_gist_decompress (internal),
+        FUNCTION        5        LWGEOM_gist_penalty (internal, internal, internal),
+        FUNCTION        6        LWGEOM_gist_picksplit (internal, internal),
+        FUNCTION        7        LWGEOM_gist_same (box2d, box2d, internal);
+
+#endif
 
        
 -------------------------------------------