[postgis-tickets] r14437 - Fix handling of hierarchical topo layers with multiple topologies

Sandro Santilli strk at keybit.net
Thu Nov 26 01:15:07 PST 2015


Author: strk
Date: 2015-11-26 01:15:07 -0800 (Thu, 26 Nov 2015)
New Revision: 14437

Modified:
   branches/2.0/NEWS
   branches/2.0/topology/topology.sql.in.c
Log:
Fix handling of hierarchical topo layers with multiple topologies

Different layers with same id in different topologies confused
GetTopoGeomElements and AddTopoGeometryColumn.

Closes #3378

Modified: branches/2.0/NEWS
===================================================================
--- branches/2.0/NEWS	2015-11-26 09:13:57 UTC (rev 14436)
+++ branches/2.0/NEWS	2015-11-26 09:15:07 UTC (rev 14437)
@@ -13,6 +13,8 @@
   - #3359, Fix toTopoGeom loss of low-id primitives from TopoGeometry
            definition
   - #3375, crash in remove repeated points
+  - #3378, Fix handling of hierarchical TopoGeometries with
+           of multiple topologies
 
 
 PostGIS 2.0.7

Modified: branches/2.0/topology/topology.sql.in.c
===================================================================
--- branches/2.0/topology/topology.sql.in.c	2015-11-26 09:13:57 UTC (rev 14436)
+++ branches/2.0/topology/topology.sql.in.c	2015-11-26 09:15:07 UTC (rev 14437)
@@ -595,6 +595,7 @@
   IF child IS NOT NULL THEN
     SELECT level + 1 FROM topology.layer
       WHERE layer_id = child
+        AND topology_id = topoid
       INTO newlevel;
     IF newlevel IS NULL THEN
       RAISE EXCEPTION 'Child layer % does not exist in topology "%"', child, toponame;
@@ -1103,13 +1104,21 @@
   query2 text;
   lyr RECORD;
   ok bool;
+  topoid INTEGER;
 BEGIN
 
+  -- Get topology id
+  SELECT id INTO topoid
+    FROM topology.topology WHERE name = toponame;
+  IF NOT FOUND THEN
+    RAISE EXCEPTION 'Topology % does not exist', quote_literal(toponame);
+  END IF;
+
   -- Get layer info
   ok = false;
-  FOR rec IN EXECUTE 'SELECT * FROM '
-    || ' topology.layer '
-    || ' WHERE layer_id = ' || layerid
+  FOR rec IN EXECUTE 'SELECT * FROM topology.layer '
+       ' WHERE layer_id = $1 AND topology_id = $2'
+       USING layerid, topoid
   LOOP
     lyr = rec;
     ok = true;



More information about the postgis-tickets mailing list