[postgis-commits] svn - r3053 - trunk/lwgeom

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


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

Modified:
   trunk/lwgeom/lwpostgis.sql.in.c
Log:
add check for invalid srid to addgeometrycolumn (#33)


Modified: trunk/lwgeom/lwpostgis.sql.in.c
===================================================================
--- trunk/lwgeom/lwpostgis.sql.in.c	2008-10-02 17:36:08 UTC (rev 3052)
+++ trunk/lwgeom/lwpostgis.sql.in.c	2008-10-02 17:36:52 UTC (rev 3053)
@@ -2544,6 +2544,7 @@
 	new_dim alias for $7;
 	rec RECORD;
 	schema_ok bool;
+	sr varchar;
 	real_schema name;
 
 BEGIN
@@ -2616,6 +2617,12 @@
 		SELECT current_schema() into real_schema;
 	END IF;
 
+	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
 



More information about the postgis-commits mailing list