[postgis-tickets] [SCM] PostGIS branch stable-3.3 updated. 3.3.2-7-gdbb891315
git at osgeo.org
git at osgeo.org
Wed Dec 7 05:03:08 PST 2022
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".
The branch, stable-3.3 has been updated
via dbb891315c716795df36f65e71b2dc453bc7795f (commit)
from 6f1fe875da0ab269fb993ed3c9cf213661ad4d6e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit dbb891315c716795df36f65e71b2dc453bc7795f
Author: Sandro Santilli <strk at kbt.io>
Date: Wed Dec 7 11:47:39 2022 +0100
Ensure CopyTopology does not violate layer triggers
Makes sure hierarchical TopoGeometry definitions are always
loaded AFTER the primitives defining them.
Closes #5298 in 3.3 branch (3.3.3dev)
Includes regression test
diff --git a/NEWS b/NEWS
index 33cfa7610..b4583c207 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ YYYY/MM/DD
* Bug Fixes *
- #5289, Fix misleading message about doubly connected edges healing (Sandro Santilli)
+ - #5298, Fix CopyTopology exception with hierarchical layers (Sandro Santilli)
PostGIS 3.3.2
2022/11/12
diff --git a/topology/sql/manage/CopyTopology.sql.in b/topology/sql/manage/CopyTopology.sql.in
index 6f938836d..580d35fd3 100644
--- a/topology/sql/manage/CopyTopology.sql.in
+++ b/topology/sql/manage/CopyTopology.sql.in
@@ -77,7 +77,12 @@ BEGIN
EXECUTE sql;
-- Copy layers and their TopoGeometry sequences
- FOR rec IN SELECT * FROM topology.layer WHERE topology_id = oldtopo_id
+ -- and their TopoGeometry definitions, from primitives
+ -- to hierarchical
+ FOR rec IN
+ SELECT * FROM topology.layer
+ WHERE topology_id = oldtopo_id
+ ORDER BY COALESCE(child_id, 0), layer_id
LOOP
INSERT INTO topology.layer (topology_id, layer_id, feature_type,
level, child_id, schema_name, table_name, feature_column)
@@ -98,17 +103,19 @@ BEGIN
rec.layer_id,
atopology
);
- END LOOP;
- -- Copy TopoGeometry definitions
- EXECUTE format(
- $$
- INSERT INTO %1$I.relation
- SELECT * FROM %2$I.relation
- $$,
- newtopo,
- atopology
- );
+ -- Copy TopoGeometry definitions
+ EXECUTE format(
+ $$
+ INSERT INTO %1$I.relation
+ SELECT * FROM %2$I.relation
+ WHERE layer_id = $1
+ $$,
+ newtopo,
+ atopology
+ ) USING rec.layer_id;
+
+ END LOOP;
RETURN newtopo_id;
END
diff --git a/topology/test/regress/copytopology.sql b/topology/test/regress/copytopology.sql
index 6602b0aed..91da3e06f 100644
--- a/topology/test/regress/copytopology.sql
+++ b/topology/test/regress/copytopology.sql
@@ -3,6 +3,7 @@ set client_min_messages to WARNING;
\i :top_builddir/topology/test/load_topology-4326.sql
\i ../load_features.sql
\i ../more_features.sql
+\i ../hierarchy.sql
SELECT topology.CopyTopology('city_data', 'CITY_data_UP_down') > 0;
@@ -46,12 +47,20 @@ SELECT tableoid::regclass AS sequence_name, last_value, is_called from "CITY_d
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');
-DROP SCHEMA features CASCADE;
+-- See https://trac.osgeo.org/postgis/ticket/5298
+BEGIN;
+UPDATE city_data.relation SEt layer_id = 1 WHERE layer_id = 1;
+SELECT '#5298', topology.CopyTopology('city_data', 'city_data_t5298') > 0;
+ROLLBACK;
-- See http://trac.osgeo.org/postgis/ticket/2184
select '#2184.1', topology.createTopology('t3d', 0, 0, true) > 0;
select '#2184.2', st_addisonode('t3d', NULL, 'POINT(1 2 3)');
select '#2184.3', topology.copyTopology('t3d', 't3d-bis') > 0;
select '#2184.4', length(topology.dropTopology('t3d')) > 0, length(topology.dropTopology('t3d-bis')) > 0;
+
+-- Cleanup
+
+SELECT topology.DropTopology('CITY_data_UP_down');
+SELECT topology.DropTopology('city_data');
+DROP SCHEMA features CASCADE;
diff --git a/topology/test/regress/copytopology_expected b/topology/test/regress/copytopology_expected
index 82a90798b..2d4431f4a 100644
--- a/topology/test/regress/copytopology_expected
+++ b/topology/test/regress/copytopology_expected
@@ -3,11 +3,14 @@ t
nodes|22
edges|24
faces|10
-relations|39
-layers|3
+relations|50
+layers|6
1|CITY_data_UP_down|LAYER1|
2|CITY_data_UP_down|LAYER2|
3|CITY_data_UP_down|LAYER3|
+4|CITY_data_UP_down|LAYER4|
+5|CITY_data_UP_down|LAYER5|
+6|CITY_data_UP_down|LAYER6|
"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
@@ -15,9 +18,10 @@ layers|3
"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
+#5298|t
#2184.1|t
#2184.2|1
#2184.3|t
#2184.4|t|t
+Topology 'CITY_data_UP_down' dropped
+Topology 'city_data' dropped
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
topology/sql/manage/CopyTopology.sql.in | 29 ++++++++++++++++++-----------
topology/test/regress/copytopology.sql | 15 ++++++++++++---
topology/test/regress/copytopology_expected | 12 ++++++++----
4 files changed, 39 insertions(+), 18 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list