[postgis-tickets] r15406 - Fix topology PostgreSQL 10 regress errors

Regina Obe lr at pcorp.us
Fri May 26 12:35:19 PDT 2017


Author: robe
Date: 2017-05-26 12:35:19 -0700 (Fri, 26 May 2017)
New Revision: 15406

Modified:
   trunk/topology/sql/topogeometry/totopogeom.sql.in
   trunk/topology/test/regress/copytopology.sql
   trunk/topology/test/regress/copytopology_expected
Log:
Fix topology PostgreSQL 10 regress errors
Change CASE WHEN SRF to use constant
Evidentally they also removed a bunch of columns from sequence table struct 
I'm guessing has to do with intro of IDENTITY column type, so had to revise copytopology regress
Closes #3764

Modified: trunk/topology/sql/topogeometry/totopogeom.sql.in
===================================================================
--- trunk/topology/sql/topogeometry/totopogeom.sql.in	2017-05-26 06:25:16 UTC (rev 15405)
+++ trunk/topology/sql/topogeometry/totopogeom.sql.in	2017-05-26 19:35:19 UTC (rev 15406)
@@ -139,6 +139,7 @@
   tolerance FLOAT8;
   alayer INT;
   atopology TEXT;
+  var_dims integer;
 BEGIN
 
 #ifdef POSTGIS_TOPOLOGY_DEBUG
@@ -239,12 +240,17 @@
     FROM (SELECT (ST_Dump(ageom)).geom) as f
     WHERE NOT ST_IsEmpty(geom)
   LOOP
-    FOR rec2 IN SELECT CASE
-       WHEN rec.dims = 0 THEN
+  	-- NOTE: storing this as a constant 
+  	-- because the CASE WHEN in PostgreSQL 10 refuses to short-circuit 
+  	-- when CASE contains set returning functions and the CASE boolean is not a constant
+  	-- TODO: this feels a little dirty to assume so may need a revisit in near future
+  	var_dims = rec.dims;
+    FOR rec2 IN SELECT CASE var_dims
+       WHEN 0 THEN
          topology.topogeo_addPoint(atopology, rec.geom, tolerance)
-       WHEN rec.dims = 1 THEN
+       WHEN 1 THEN
          topology.topogeo_addLineString(atopology, rec.geom, tolerance)
-       WHEN rec.dims = 2 THEN
+       WHEN 2 THEN
          topology.topogeo_addPolygon(atopology, rec.geom, tolerance)
        END as primitive
     LOOP

Modified: trunk/topology/test/regress/copytopology.sql
===================================================================
--- trunk/topology/test/regress/copytopology.sql	2017-05-26 06:25:16 UTC (rev 15405)
+++ trunk/topology/test/regress/copytopology.sql	2017-05-26 19:35:19 UTC (rev 15406)
@@ -39,13 +39,13 @@
 ORDER BY l.layer_id;
 
 -- Check sequences
-SELECT * from "CITY_data_UP_down".node_node_id_seq;
-SELECT * from "CITY_data_UP_down".edge_data_edge_id_seq;
-SELECT * from "CITY_data_UP_down".face_face_id_seq;
-SELECT sequence_name, last_value, start_value, increment_by, max_value, min_value, cache_value, is_cycled, is_called from "CITY_data_UP_down".layer_id_seq;
-SELECT * from "CITY_data_UP_down".topogeo_s_1;
-SELECT * from "CITY_data_UP_down".topogeo_s_2;
-SELECT * from "CITY_data_UP_down".topogeo_s_3;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called from "CITY_data_UP_down".node_node_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called from "CITY_data_UP_down".edge_data_edge_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called from "CITY_data_UP_down".face_face_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called from "CITY_data_UP_down".layer_id_seq;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called  from "CITY_data_UP_down".topogeo_s_1;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called  from "CITY_data_UP_down".topogeo_s_2;
+SELECT tableoid::regclass AS sequence_name, last_value,  is_called  from "CITY_data_UP_down".topogeo_s_3;
 
 SELECT topology.DropTopology('CITY_data_UP_down');
 SELECT topology.DropTopology('city_data');

Modified: trunk/topology/test/regress/copytopology_expected
===================================================================
--- trunk/topology/test/regress/copytopology_expected	2017-05-26 06:25:16 UTC (rev 15405)
+++ trunk/topology/test/regress/copytopology_expected	2017-05-26 19:35:19 UTC (rev 15406)
@@ -19,13 +19,13 @@
 1|CITY_data_UP_down|LAYER1|
 2|CITY_data_UP_down|LAYER2|
 3|CITY_data_UP_down|LAYER3|
-node_node_id_seq|22|1|1|9223372036854775807|1|1|0|f|t
-edge_data_edge_id_seq|26|1|1|9223372036854775807|1|1|0|f|t
-face_face_id_seq|9|1|1|9223372036854775807|1|1|0|f|t
-layer_id_seq|1|1|1|9223372036854775807|1|1|f|f
-topogeo_s_1|9|1|1|9223372036854775807|1|1|0|f|t
-topogeo_s_2|8|1|1|9223372036854775807|1|1|0|f|t
-topogeo_s_3|8|1|1|9223372036854775807|1|1|0|f|t
+"CITY_data_UP_down".node_node_id_seq|22|t
+"CITY_data_UP_down".edge_data_edge_id_seq|26|t
+"CITY_data_UP_down".face_face_id_seq|9|t
+"CITY_data_UP_down".layer_id_seq|1|f
+"CITY_data_UP_down".topogeo_s_1|9|t
+"CITY_data_UP_down".topogeo_s_2|8|t
+"CITY_data_UP_down".topogeo_s_3|8|t
 Topology 'CITY_data_UP_down' dropped
 Topology 'city_data' dropped
 #2184.1|t



More information about the postgis-tickets mailing list