[postgis-commits] svn - r3104 - branches/1.3/lwgeom

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Tue Oct 14 11:59:05 PDT 2008


Author: pramsey
Date: 2008-10-14 11:59:05 -0700 (Tue, 14 Oct 2008)
New Revision: 3104

Modified:
   branches/1.3/lwgeom/lwgeom_gist.c
Log:
ifdef pgsql 7.2 back to original behavior, since sliced detoasting
is not supported.


Modified: branches/1.3/lwgeom/lwgeom_gist.c
===================================================================
--- branches/1.3/lwgeom/lwgeom_gist.c	2008-10-14 18:16:03 UTC (rev 3103)
+++ branches/1.3/lwgeom/lwgeom_gist.c	2008-10-14 18:59:05 UTC (rev 3104)
@@ -592,8 +592,11 @@
 	PG_LWGEOM *query ; /* lwgeom serialized form */
 	StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
 	bool result;
+	BOX2DFLOAT4  box;
+#if USE_VERSION > 72
+	/* For sliced de-toasting code */
 	uchar *serialized_lwgeom;
-	BOX2DFLOAT4  box;
+#endif
 
 #ifdef PGIS_DEBUG_CALLS
 	elog(NOTICE,"GIST: LWGEOM_gist_consistent called");
@@ -605,7 +608,25 @@
 		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 @@
 			PG_RETURN_BOOL(FALSE);
 		}
 	}
+#endif
 
 	if (GIST_LEAF(entry))
 		result = lwgeom_rtree_leaf_consistent((BOX2DFLOAT4 *)



More information about the postgis-commits mailing list