]> granicus.if.org Git - postgis/commitdiff
Fix topology PostgreSQL 10 regress errors
authorRegina Obe <lr@pcorp.us>
Fri, 26 May 2017 19:35:19 +0000 (19:35 +0000)
committerRegina Obe <lr@pcorp.us>
Fri, 26 May 2017 19:35:19 +0000 (19:35 +0000)
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

git-svn-id: http://svn.osgeo.org/postgis/trunk@15406 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/topogeometry/totopogeom.sql.in
topology/test/regress/copytopology.sql
topology/test/regress/copytopology_expected

index 79520c64e9124652f7c0db42974c08b3bbffc793..5f8db898c7bf684ce9a901ba853a6bd70f488df8 100644 (file)
@@ -139,6 +139,7 @@ DECLARE
   tolerance FLOAT8;
   alayer INT;
   atopology TEXT;
+  var_dims integer;
 BEGIN
 
 #ifdef POSTGIS_TOPOLOGY_DEBUG
@@ -239,12 +240,17 @@ BEGIN
     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
index 414e01993b819b7918383197ee11e7235f6bea42..182ff493cb8d9fd731efbd88637b73fa6d4ea919 100644 (file)
@@ -39,13 +39,13 @@ WHERE l.topology_id = t.id and t.name = 'CITY_data_UP_down'
 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');
index 95083dbbf87276643bd6f18a92b9fbbd9daee753..ffdb1316b8c350bd55f80e380de264556571895d 100644 (file)
@@ -19,13 +19,13 @@ layers|3
 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