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

postgis-commits at postgis.refractions.net postgis-commits at postgis.refractions.net
Thu Oct 2 10:36:08 PDT 2008


Author: pramsey
Date: 2008-10-02 10:36:08 -0700 (Thu, 02 Oct 2008)
New Revision: 3052

Modified:
   branches/1.3/lwgeom/lwpostgis.sql.in
Log:
Add check for invalid SRID to addgeometrycolumn


Modified: branches/1.3/lwgeom/lwpostgis.sql.in
===================================================================
--- branches/1.3/lwgeom/lwpostgis.sql.in	2008-10-02 17:20:21 UTC (rev 3051)
+++ branches/1.3/lwgeom/lwpostgis.sql.in	2008-10-02 17:36:08 UTC (rev 3052)
@@ -3035,6 +3035,7 @@
 	new_srid alias for $5;
 	new_type alias for $6;
 	new_dim alias for $7;
+	sr varchar;
 #if USE_VERSION >= 73
 	rec RECORD;
 	schema_ok bool;
@@ -3113,7 +3114,14 @@
 	END IF;
 #endif
 
+	IF ( new_srid != -1 ) THEN
+		SELECT SRID INTO sr FROM SPATIAL_REF_SYS WHERE SRID = new_srid;
+		IF NOT FOUND THEN
+			RAISE EXCEPTION 'AddGeometryColumns() - invalid SRID';
+		END IF;
+	END IF;
 
+
 	-- Add geometry column
 
 	EXECUTE ''ALTER TABLE '' ||



More information about the postgis-commits mailing list