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
tolerance FLOAT8;
alayer INT;
atopology TEXT;
+ var_dims integer;
BEGIN
#ifdef POSTGIS_TOPOLOGY_DEBUG
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
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');
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