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

Sandro Santilli strk at keybit.net
Thu Nov 26 01:13:10 PST 2015


Author: strk
Date: 2015-11-26 01:13:09 -0800 (Thu, 26 Nov 2015)
New Revision: 14435

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

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

See #3378

Modified: branches/2.1/NEWS
===================================================================
--- branches/2.1/NEWS	2015-11-26 09:08:17 UTC (rev 14434)
+++ branches/2.1/NEWS	2015-11-26 09:13:09 UTC (rev 14435)
@@ -17,8 +17,9 @@
   - #3359, Fix toTopoGeom loss of low-id primitives from TopoGeometry
            definition
   - #3375, crash in repeated point removal for collection(point)
+  - #3378, Fix handling of hierarchical TopoGeometries with
+           of multiple topologies
 
-
 PostGIS 2.1.8
 2015/07/07
 

Modified: branches/2.1/topology/topology.sql.in
===================================================================
--- branches/2.1/topology/topology.sql.in	2015-11-26 09:08:17 UTC (rev 14434)
+++ branches/2.1/topology/topology.sql.in	2015-11-26 09:13:09 UTC (rev 14435)
@@ -596,6 +596,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;
@@ -1106,13 +1107,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