]> granicus.if.org Git - postgis/commitdiff
Fix a bug in topology.add{Node,Edge,Face} breaking on MixedCased topology names ...
authorSandro Santilli <strk@keybit.net>
Fri, 4 Feb 2011 16:31:34 +0000 (16:31 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 4 Feb 2011 16:31:34 +0000 (16:31 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6775 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/populate.sql
topology/test/regress/addedge.sql
topology/test/regress/addedge_expected
topology/test/regress/addface.sql
topology/test/regress/addface_expected
topology/test/regress/addnode.sql
topology/test/regress/addnode_expected

index 33a16adb0902f2acbd5ed188ee8f02f2a6c8dec9..f4b3200f15a1759218fc07fd5e19510e5671bd33 100644 (file)
@@ -96,8 +96,10 @@ BEGIN
        --
        -- Get new node id from sequence
        --
-       FOR rec IN EXECUTE 'SELECT nextval(''' ||
-               atopology || '.node_node_id_seq'')'
+       FOR rec IN EXECUTE 'SELECT nextval(' ||
+               quote_literal(
+                       quote_ident(atopology) || '.node_node_id_seq'
+               ) || ')'
        LOOP
                nodeid = rec.nextval;
        END LOOP;
@@ -311,8 +313,10 @@ BEGIN
        --
        -- Get new edge id from sequence
        --
-       FOR rec IN EXECUTE 'SELECT nextval(''' ||
-               atopology || '.edge_data_edge_id_seq'')'
+       FOR rec IN EXECUTE 'SELECT nextval(' ||
+               quote_literal(
+                       quote_ident(atopology) || '.edge_data_edge_id_seq'
+               ) || ')'
        LOOP
                edgeid = rec.nextval;
        END LOOP;
@@ -508,8 +512,10 @@ BEGIN
        --
        -- Get new face id from sequence
        --
-       FOR rec IN EXECUTE 'SELECT nextval(''' ||
-               atopology || '.face_face_id_seq'')'
+       FOR rec IN EXECUTE 'SELECT nextval(' ||
+               quote_literal(
+                       quote_ident(atopology) || '.face_face_id_seq'
+               ) || ')'
        LOOP
                faceid = rec.nextval;
        END LOOP;
index 954ae76774fa11748f9c22cd0d81817263f96d0f..78c1f01c589b78384e01387a51072f8026cb3be2 100644 (file)
@@ -64,3 +64,8 @@ SELECT edge_id, left_face, right_face,
        st_astext(geom) from tt.edge ORDER by edge_id;
 
 SELECT topology.DropTopology('tt');
+
+-- Test topology with MixedCase
+SELECT topology.CreateTopology('Ul') > 0;
+SELECT 'MiX',  topology.addEdge('Ul', 'LINESTRING(0 0, 8 0)');
+SELECT topology.DropTopology('Ul');
index f381ca3724b8e251a495e6fe32586ed937c61454..4c6445ba0362d367bcc692492a9156dd1ec2469b 100644 (file)
@@ -30,3 +30,6 @@ ERROR:  Edge intersects (not on endpoints) with existing edge 7 at or near point
 7|0|0|7|7|LINESTRING(8 10,10 10,10 12,8 10)
 8|0|0|8|8|LINESTRING(8 10,9 8,10 9,8 10)
 Topology 'tt' dropped
+t
+MiX|1
+Topology 'Ul' dropped
index 4f5ce915b1548440a2ca55562a975116d7c96fc2..214652be3a1240245d8aef055e2ea7cd11ef6a66 100644 (file)
@@ -41,3 +41,12 @@ SELECT face_id, Box2d(mbr) from tt.face ORDER by face_id;
 SELECT edge_id, left_face, right_face from tt.edge ORDER by edge_id;
 
 SELECT topology.DropTopology('tt');
+
+-- Test topology with MixedCase
+SELECT topology.CreateTopology('Ul') > 0;
+SELECT 'MiX-e1',  topology.addEdge('Ul', 'LINESTRING(0 0, 10 0)');
+SELECT 'MiX-e2',  topology.addEdge('Ul', 'LINESTRING(10 0, 10 10)');
+SELECT 'MiX-e3',  topology.addEdge('Ul', 'LINESTRING(0 10, 10 10)');
+SELECT 'MiX-e4',  topology.addEdge('Ul', 'LINESTRING(0 0, 0 10)');
+SELECT 'MiX-f1',  topology.addFace('Ul', 'POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))');
+SELECT topology.DropTopology('Ul');
index 1d9a9a7b7b5aa01591c7c4b6d86b0054f9ed939e..73c4035933b9fad6238e9bab89c8b0fb44fddd62 100644 (file)
@@ -28,3 +28,12 @@ f2|2
 7|0|2
 8|0|2
 Topology 'tt' dropped
+t
+MiX-e1|1
+MiX-e2|2
+MiX-e3|3
+MiX-e4|4
+WARNING:  Not checking if face contains any edge
+WARNING:  Not updating next_{left,right}_face fields of face boundary edges
+MiX-f1|1
+Topology 'Ul' dropped
index f2a35291813ce7e9db76a5acdbe6da9525a7f884..cc5ed9730c1d1fbb9da495633218cb05bb9ea0ea 100644 (file)
@@ -29,3 +29,8 @@ SELECT node_id, containing_face, st_astext(geom) from nodes.node
 ORDER by node_id;
 
 SELECT topology.DropTopology('nodes');
+
+-- Test topology with MixedCase
+SELECT topology.CreateTopology('Ul') > 0;
+SELECT 'MiX',  topology.addNode('Ul', 'POINT(0 0)');
+SELECT topology.DropTopology('Ul');
index adefefec2d7512e31ced56324f9aa522bc4c4143..1967cbb862ee32c400ad88f094fed0463301770e 100644 (file)
@@ -13,3 +13,6 @@ p5|5
 4||POINT(10 10)
 5||POINT(0 20)
 Topology 'nodes' dropped
+t
+MiX|1
+Topology 'Ul' dropped