]> granicus.if.org Git - postgis/commitdiff
#2190: further cleanup of topology existence checking so regresses for 9.3. Should...
authorRegina Obe <lr@pcorp.us>
Sat, 2 Feb 2013 23:48:13 +0000 (23:48 +0000)
committerRegina Obe <lr@pcorp.us>
Sat, 2 Feb 2013 23:48:13 +0000 (23:48 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@11076 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/sqlmm.sql.in.c
topology/test/regress/st_modedgesplit_expected
topology/test/regress/st_newedgessplit_expected

index 67a0dced2f449373aaff4f28c62408af29f8cb8d..3eb90f0622968d24f23a5cb2106decb98b212030 100644 (file)
@@ -57,8 +57,8 @@ BEGIN
     RAISE EXCEPTION 'SQL/MM Spatial exception - null argument';
   END IF;
 
-  IF toponame = '' THEN
-        RAISE EXCEPTION 'SQL/MM Spatial exception - invalid topology name';
+  IF NOT EXISTS(SELECT name FROM topology WHERE name = toponame)  THEN
+    RAISE EXCEPTION 'SQL/MM Spatial exception - invalid topology name';
   END IF;
 
   n := 1;
@@ -1393,7 +1393,7 @@ BEGIN
     RAISE EXCEPTION 'SQL/MM Spatial exception - null argument';
   END IF;
 
-  IF toponame = '' THEN
+  IF NOT EXISTS(SELECT name FROM topology WHERE name = toponame)  THEN
     RAISE EXCEPTION 'SQL/MM Spatial exception - invalid topology name';
   END IF;
 
@@ -1817,6 +1817,15 @@ BEGIN
     RAISE EXCEPTION
      'SQL/MM Spatial exception - null argument';
   END IF;
+  
+  -- Get topology id
+  BEGIN
+    SELECT id FROM topology.topology
+      INTO STRICT topoid WHERE name = atopology;
+    EXCEPTION
+      WHEN NO_DATA_FOUND THEN
+        RAISE EXCEPTION 'SQL/MM Spatial exception - invalid topology name';
+  END;
 
   --
   -- Check node existance
@@ -1996,14 +2005,6 @@ BEGIN
     || ' AND edge_id NOT IN (' || edgeid1 || ',' || edgeid2 || ')'
     ;
 
-  -- Get topology id
-        SELECT id FROM topology.topology into topoid
-                WHERE name = atopology;
-  IF topoid IS NULL THEN
-    RAISE EXCEPTION 'No topology % registered',
-      quote_ident(atopology);
-  END IF;
-
   --
   -- Update references in the Relation table.
   -- We only take into considerations non-hierarchical
@@ -2115,8 +2116,13 @@ BEGIN
   END IF;
 
   -- Get topology id
-  SELECT id FROM topology.topology into topoid
-    WHERE name = atopology;
+  BEGIN
+    SELECT id FROM topology.topology
+      INTO STRICT topoid WHERE name = atopology;
+    EXCEPTION
+      WHEN NO_DATA_FOUND THEN
+        RAISE EXCEPTION 'SQL/MM Spatial exception - invalid topology name';
+  END;
 
   --
   -- Check node existance
index c91dc4568d40072f12987b52f05df17084d0a9e0..443833d3c93d98262afdc2c53704598c86bbcb5b 100644 (file)
@@ -8,11 +8,11 @@ max|node|22
 max|edge|26
 ERROR:  geometry has too many points at character 53
 ERROR:  SQL/MM Spatial exception - point not on edge
-ERROR:  zero-length delimited identifier at or near """" at character 15
+ERROR:  SQL/MM Spatial exception - invalid topology name
 ERROR:  SQL/MM Spatial exception - null argument
 ERROR:  SQL/MM Spatial exception - null argument
 ERROR:  SQL/MM Spatial exception - null argument
-ERROR:  schema "fake" does not exist at character 15
+ERROR:  SQL/MM Spatial exception - invalid topology name
 noniso|23
 N|23||POINT(28 14)
 E|10|sn13|en23|nl27|nr17|lf7|rf4
index 8bf6e6750ca28b94cc72b128d873a6554c4c093f..771d071013b9612af9df886ab40c8e529881e7a7 100644 (file)
@@ -8,11 +8,11 @@ max|node|22
 max|edge|26
 ERROR:  geometry has too many points at character 54
 ERROR:  SQL/MM Spatial exception - point not on edge
-ERROR:  zero-length delimited identifier at or near """" at character 15
+ERROR:  SQL/MM Spatial exception - invalid topology name
 ERROR:  SQL/MM Spatial exception - null argument
 ERROR:  SQL/MM Spatial exception - null argument
 ERROR:  SQL/MM Spatial exception - null argument
-ERROR:  schema "fake" does not exist at character 15
+ERROR:  SQL/MM Spatial exception - invalid topology name
 noniso|23
 N|23||POINT(28 14)
 E|27|sn13|en23|nl28|nr17|lf7|rf4