]> granicus.if.org Git - postgis/commitdiff
ifdef pgsql 7.2 back to original behavior, since sliced detoasting
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 14 Oct 2008 18:59:05 +0000 (18:59 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 14 Oct 2008 18:59:05 +0000 (18:59 +0000)
is not supported.

git-svn-id: http://svn.osgeo.org/postgis/branches/1.3@3104 b70326c6-7e19-0410-871a-916f4a2858ee

lwgeom/lwgeom_gist.c

index 004b3989f7cedb967283361a4be2f079111c0562..6755fc39ac946860b5be387095f9ed85a9d537a7 100644 (file)
@@ -592,8 +592,11 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
        PG_LWGEOM *query ; /* lwgeom serialized form */
        StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
        bool result;
-       uchar *serialized_lwgeom;
        BOX2DFLOAT4  box;
+#if USE_VERSION > 72
+       /* For sliced de-toasting code */
+       uchar *serialized_lwgeom;
+#endif
 
 #ifdef PGIS_DEBUG_CALLS
        elog(NOTICE,"GIST: LWGEOM_gist_consistent called");
@@ -605,6 +608,24 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
                PG_RETURN_BOOL(false); /* null query - this is screwy! */
        }
 
+#if USE_VERSION <= 72
+       /* 
+       ** PgSQL 7.2 doesn't support sliced detoasting.
+       */
+       query = (PG_LWGEOM*)PG_DETOAST_DATUM(PG_GETARG_DATUM(1)); 
+
+       if ( ! (DatumGetPointer(entry->key) != NULL && query) )
+       {
+               PG_FREE_IF_COPY(query, 1);
+               elog(ERROR, "LWGEOM_gist_consistent got either NULL query or entry->key");
+               PG_RETURN_BOOL(FALSE);
+       }
+       if ( ! getbox2d_p(SERIALIZED_FORM(query), &box) )
+       {
+               PG_FREE_IF_COPY(query, 1);
+               PG_RETURN_BOOL(FALSE);
+       }
+#else
        /* 
        ** First pull only a small amount of the tuple, enough to 
        ** get the bounding box, if one exists.
@@ -637,6 +658,7 @@ Datum LWGEOM_gist_consistent(PG_FUNCTION_ARGS)
                        PG_RETURN_BOOL(FALSE);
                }
        }
+#endif
 
        if (GIST_LEAF(entry))
                result = lwgeom_rtree_leaf_consistent((BOX2DFLOAT4 *)