[postgis-users] Vacuum analyse ERROR: Operation ontwoGEOMETRIESwith different SRIDs

strk at refractions.net strk at refractions.net
Wed Jun 15 07:48:19 PDT 2005


On Wed, Jun 15, 2005 at 04:40:55PM +0200, strk at refractions.net wrote:
> On Wed, Jun 15, 2005 at 01:03:13PM +0100, Mark Cave-Ayland wrote:
> ..
> > As a compromise, how about just changing the semantics for the btree "less
> > than" and "equals" operators to the following:
> > 
> > 	i) PG 7.1 - issue a NOTICE but continue
> > 	ii) PG > 7.1 and PG < 8.0 - issue a WARNING but continue
> 
> I like the idea.
> I verified WARNING to be in 74 and NOT in 72, can anyone
> test on 73 ?

I've checked pgsql CVS, it seems 73 has WARNINGS already.
Attached is a patch for the 0-9 branch, any test is appreciated.

--strk;
-------------- next part --------------
Index: postgis_ops.c
===================================================================
RCS file: /home/cvs/postgis/postgis/Attic/postgis_ops.c,v
retrieving revision 1.13
diff -U2 -r1.13 postgis_ops.c
--- postgis_ops.c	28 Apr 2004 22:26:02 -0000	1.13
+++ postgis_ops.c	15 Jun 2005 14:42:32 -0000
@@ -303,4 +303,14 @@
  ***********************************************************/
 
+#if USE_VERSION == 72
+#define BTREE_SRID_MISMATCH_SEVERITY NOTICE
+#else
+#if USE_VERSION < 80
+#define BTREE_SRID_MISMATCH_SEVERITY WARNING
+#else
+#define BTREE_SRID_MISMATCH_SEVERITY ERROR
+#endif
+#endif
+
 
 PG_FUNCTION_INFO_V1(geometry_lt);
@@ -312,9 +322,10 @@
 	//elog(NOTICE, "geometry_lt called");
 
+	// ERROR not used in pg<800 to avoid failure of 'analyze' operation
 	if (geom1->SRID != geom2->SRID)
 	{
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 
@@ -364,7 +375,7 @@
 		if ( (Pointer *)PG_GETARG_DATUM(0) != (Pointer *)geom1 ) pfree(geom1);
 		if ( (Pointer *)PG_GETARG_DATUM(1) != (Pointer *)geom2 ) pfree(geom2);
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 
@@ -459,7 +470,7 @@
 		if ( (Pointer *)PG_GETARG_DATUM(0) != (Pointer *)geom1 ) pfree(geom1);
 		if ( (Pointer *)PG_GETARG_DATUM(1) != (Pointer *)geom2 ) pfree(geom2);
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 
@@ -524,7 +535,7 @@
 		if ( (Pointer *)PG_GETARG_DATUM(0) != (Pointer *)geom1 ) pfree(geom1);
 		if ( (Pointer *)PG_GETARG_DATUM(1) != (Pointer *)geom2 ) pfree(geom2);
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 
@@ -609,7 +620,7 @@
 		if ( (Pointer *)PG_GETARG_DATUM(1) != (Pointer *)geom2 )
 			pfree(geom2);
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 
@@ -688,7 +699,7 @@
 		if ( (Pointer *)PG_GETARG_DATUM(1) != (Pointer *)geom2 )
 			pfree(geom2);
-		elog(ERROR,
+		elog(BTREE_SRID_MISMATCH_SEVERITY,
 			"Operation on two GEOMETRIES with different SRIDs\n");
-		PG_RETURN_NULL();
+		//PG_RETURN_NULL();
 	}
 


More information about the postgis-users mailing list