[postgis-tickets] r15439 - Clean up of formatting of r15406.

Regina Obe lr at pcorp.us
Tue Jun 20 16:29:37 PDT 2017


Author: robe
Date: 2017-06-20 16:29:37 -0700 (Tue, 20 Jun 2017)
New Revision: 15439

Modified:
   trunk/topology/sql/topogeometry/totopogeom.sql.in
Log:
Clean up of formatting of r15406.  
Add some explanation of change from CASE to UNION ALL
change SELECT ST_Dump to FROM ST_Dump per strk's suggestion
References #3764
For more details refer to https://www.postgresql.org/message-id/000001d2d5de%24d8d66170%248a832450%24%40pcorp.us
and commit that I think introduced the original problem - https://www.postgresql.org/message-id/E1cTy4K-00085H-5v@gemulon.postgresql.org

Modified: trunk/topology/sql/topogeometry/totopogeom.sql.in
===================================================================
--- trunk/topology/sql/topogeometry/totopogeom.sql.in	2017-06-20 22:16:18 UTC (rev 15438)
+++ trunk/topology/sql/topogeometry/totopogeom.sql.in	2017-06-20 23:29:37 UTC (rev 15439)
@@ -236,16 +236,24 @@
   -- definition by splitting
   FOR rec IN SELECT id(tg), alayer as lyr,
     geom, ST_Dimension(geom) as dims
-    FROM (SELECT (ST_Dump(ageom)).geom) as f
+    FROM (SELECT gd.geom FROM ST_Dump(ageom) AS gd ) as f
     WHERE NOT ST_IsEmpty(geom)
   LOOP
+    -- NOTE: Switched from using case to this because of PG 10 behavior change
+    -- Using a UNION ALL only one will be processed because of the WHERE
+    -- Since the WHERE clause will be processed first
     FOR rec2 IN SELECT primitive
-                  FROM
-                  (SELECT topology.topogeo_addPoint(atopology, rec.geom, tolerance)  WHERE rec.dims = 0
-                    UNION ALL
-                  SELECT topology.topogeo_addLineString(atopology, rec.geom, tolerance)  WHERE rec.dims = 1
-                    UNION ALL
-                  SELECT topology.topogeo_addPolygon(atopology, rec.geom, tolerance)  WHERE rec.dims = 2 ) AS f(primitive)
+          FROM
+            (
+              SELECT topology.topogeo_addPoint(atopology, rec.geom, tolerance)
+                WHERE rec.dims = 0
+              UNION ALL
+              SELECT topology.topogeo_addLineString(atopology, rec.geom, tolerance)
+                WHERE rec.dims = 1
+              UNION ALL
+              SELECT topology.topogeo_addPolygon(atopology, rec.geom, tolerance)
+                WHERE rec.dims = 2
+            ) AS f(primitive)
     LOOP
       elem := ARRAY[rec.dims+1, rec2.primitive]::text;
       IF elems @> ARRAY[elem] THEN



More information about the postgis-tickets mailing list