From: Regina Obe Date: Sat, 2 Feb 2013 23:48:13 +0000 (+0000) Subject: #2190: further cleanup of topology existence checking so regresses for 9.3. Should... X-Git-Tag: 2.1.0beta2~224 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88de793472c3ed4ae10fdbf31b95383d4f73376a;p=postgis #2190: further cleanup of topology existence checking so regresses for 9.3. Should pass with flying colors now. git-svn-id: http://svn.osgeo.org/postgis/trunk@11076 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/topology/sql/sqlmm.sql.in.c b/topology/sql/sqlmm.sql.in.c index 67a0dced2..3eb90f062 100644 --- a/topology/sql/sqlmm.sql.in.c +++ b/topology/sql/sqlmm.sql.in.c @@ -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 diff --git a/topology/test/regress/st_modedgesplit_expected b/topology/test/regress/st_modedgesplit_expected index c91dc4568..443833d3c 100644 --- a/topology/test/regress/st_modedgesplit_expected +++ b/topology/test/regress/st_modedgesplit_expected @@ -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 diff --git a/topology/test/regress/st_newedgessplit_expected b/topology/test/regress/st_newedgessplit_expected index 8bf6e6750..771d07101 100644 --- a/topology/test/regress/st_newedgessplit_expected +++ b/topology/test/regress/st_newedgessplit_expected @@ -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