[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-386-g68f392dc0
git at osgeo.org
git at osgeo.org
Wed Dec 7 05:02:30 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, master has been updated
via 68f392dc0387f4f2e97b52213f3e1afa2c5ee6e0 (commit)
from 32d9b5f117140c239677b695f8bd79aeef8c19b5 (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 68f392dc0387f4f2e97b52213f3e1afa2c5ee6e0
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.
References #5298 in master branch (3.4.0dev)
Includes regression test
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:
topology/sql/manage/CopyTopology.sql.in | 29 ++++++++++++++++++-----------
topology/test/regress/copytopology.sql | 15 ++++++++++++---
topology/test/regress/copytopology_expected | 12 ++++++++----
3 files changed, 38 insertions(+), 18 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list