[postgis-tickets] [SCM] PostGIS branch main updated. 3.1.0rc1-343-g76cf8de

git at osgeo.org git at osgeo.org
Wed Jul 14 15:38:59 PDT 2021


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, main has been updated
       via  76cf8de9bc301b9a28809ce8dd5ca4e92fcab559 (commit)
      from  fba9339b0f21aed583e6e8bbe35d648756339568 (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 76cf8de9bc301b9a28809ce8dd5ca4e92fcab559
Author: Sandro Santilli <strk at kbt.io>
Date:   Thu Jul 15 00:36:09 2021 +0200

    Also check TopoGeometries in collection layers for preventing edge heal and node removal
    
    Includes test

diff --git a/topology/postgis_topology.c b/topology/postgis_topology.c
index f51793a..c02ab6a 100644
--- a/topology/postgis_topology.c
+++ b/topology/postgis_topology.c
@@ -2572,9 +2572,9 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
                     "r.layer_id, l.schema_name, l.table_name, l.feature_column, "
                     "array_agg(abs(r.element_id)) as elems FROM topology.layer l "
                     " INNER JOIN \"%s\".relation r ON (l.layer_id = r.layer_id) "
-                    "WHERE l.level = 0 and l.feature_type = 2 "
+                    "WHERE l.level = 0 and l.feature_type in ( 2, 4 ) "
                     "AND l.topology_id = %d"
-                    " AND abs(r.element_id) = ANY (ARRAY[%" LWTFMT_ELEMID ",%" LWTFMT_ELEMID
+                    " AND r.element_type = 2 AND abs(r.element_id) = ANY (ARRAY[%" LWTFMT_ELEMID ",%" LWTFMT_ELEMID
                     "]::int4[]) group by r.topogeo_id, r.layer_id, l.schema_name, "
                     "l.table_name, l.feature_column ) t WHERE NOT t.elems @> ARRAY[%"
                     LWTFMT_ELEMID ",%" LWTFMT_ELEMID "]::int4[] LIMIT 1",
@@ -2624,7 +2624,7 @@ cb_checkTopoGeomRemNode ( const LWT_BE_TOPOLOGY* topo,
                     " INNER JOIN \"%s\".relation r ON (l.layer_id = r.layer_id) "
                     "WHERE l.level = 0 and l.feature_type in ( 1, 4 ) "
                     "AND l.topology_id = %d"
-                    " AND r.element_id = %" LWTFMT_ELEMID
+                    " AND r.element_type = 1 AND r.element_id = %" LWTFMT_ELEMID
                     " group by r.topogeo_id, r.layer_id, l.schema_name, "
                     "l.table_name, l.feature_column ) t LIMIT 1",
                     topo->name, topo->id,
@@ -2691,7 +2691,7 @@ cb_checkTopoGeomRemIsoNode ( const LWT_BE_TOPOLOGY* topo, LWT_ELEMID rem_node )
                     " INNER JOIN \"%s\".relation r ON (l.layer_id = r.layer_id) "
                     "WHERE l.level = 0 and l.feature_type in ( 1, 4 ) "
                     "AND l.topology_id = %d"
-                    " AND r.element_id = %" LWTFMT_ELEMID
+                    " AND r.element_type = 1 AND r.element_id = %" LWTFMT_ELEMID
                     " group by r.topogeo_id, r.layer_id, l.schema_name, "
                     "l.table_name, l.feature_column ) t LIMIT 1",
                     topo->name, topo->id,
diff --git a/topology/test/regress/st_modedgeheal.sql b/topology/test/regress/st_modedgeheal.sql
index 842426a..d827951 100644
--- a/topology/test/regress/st_modedgeheal.sql
+++ b/topology/test/regress/st_modedgeheal.sql
@@ -73,47 +73,49 @@ SELECT 'N'||topology.TopoGeo_AddPoint('t', 'POINT(2 8)');  -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2 2, 2  8)');        -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
+-- Cannot heal edges connected by node used in point TopoGeometry
+-- See https://trac.osgeo.org/postgis/ticket/3239
 INSERT INTO t.f_poi VALUES ('F+N1',
   topology.CreateTopoGeom('t', 1, 2, '{{1,1}}'));
-
--- This should be forbidden, as F+N1 above could not be
--- defined w/out the joining node
--- See https://trac.osgeo.org/postgis/ticket/3239
 SELECT 'unexpected-success-with-orphaned-point-topogeom-1',
   topology.ST_ModEdgeHeal('t', 1, 2);
 SELECT 'unexpected-success-with-orphaned-point-topogeom-2',
   topology.ST_ModEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_poi RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
-WITH deleted AS (
-  DELETE FROM t.f_poi RETURNING g
-), clear AS (
-  SELECT ClearTopoGeom(g) FROM deleted
-) SELECT NULL FROM clear;
-
+-- Cannot heal edges connected by node used in collection TopoGeometry
+-- See https://trac.osgeo.org/postgis/ticket/3239
 INSERT INTO t.f_mix VALUES ('F+N1',
   topology.CreateTopoGeom('t', 4, 3, '{{1,1}}'));
-
--- This should be forbidden, as F+N1 above could not be
--- defined w/out the joining node
--- See https://trac.osgeo.org/postgis/ticket/3239
 SELECT 'unexpected-success-with-orphaned-mix-topogeom-1',
   topology.ST_ModEdgeHeal('t', 1, 2);
 SELECT 'unexpected-success-with-orphaned-mix-topogeom-2',
   topology.ST_ModEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_mix RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
-WITH deleted AS (
-  DELETE FROM t.f_mix RETURNING g
-), clear AS (
-  SELECT ClearTopoGeom(g) FROM deleted
-) SELECT NULL FROM clear;
-
+---- Cannot heal edges when only one is used in line TopoGeometry
+---- defined w/out one of the edges
 INSERT INTO t.f_lin VALUES ('F+E1',
   topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
+SELECT topology.ST_ModEdgeHeal('t', 1, 2);
+SELECT topology.ST_ModEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_lin RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
--- This should be forbidden, as F+E1 above could not be
+-- Cannot heal edges when only one is used in collection TopoGeometry
 -- defined w/out one of the edges
+INSERT INTO t.f_mix VALUES ('F+E1',
+  topology.CreateTopoGeom('t', 4, 3, '{{1,2}}'));
 SELECT topology.ST_ModEdgeHeal('t', 1, 2);
 SELECT topology.ST_ModEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_mix RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
 -- This is for ticket #941
 SELECT topology.ST_ModEdgeHeal('t', 1, 200);
diff --git a/topology/test/regress/st_newedgeheal.sql b/topology/test/regress/st_newedgeheal.sql
index 6d4545d..e162b78 100644
--- a/topology/test/regress/st_newedgeheal.sql
+++ b/topology/test/regress/st_newedgeheal.sql
@@ -73,47 +73,50 @@ SELECT 'N'||topology.TopoGeo_AddPoint('t', 'POINT(2 8)');  -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2 2, 2  8)');        -- 1
 SELECT 'E'||topology.AddEdge('t', 'LINESTRING(2  8,  8  8)');      -- 2
 
-INSERT INTO t.f_poi VALUES ('F+N1',
-  topology.CreateTopoGeom('t', 1, 2, '{{1,1}}'));
 
--- This should be forbidden, as F+N1 above could not be
--- defined w/out the joining node
+-- Cannot heal edges connected by node used in point TopoGeometry
 -- See https://trac.osgeo.org/postgis/ticket/3239
+INSERT INTO t.f_poi VALUES ('F+N1',
+  topology.CreateTopoGeom('t', 1, 2, '{{1,1}}'));
 SELECT 'unexpected-success-with-orphaned-point-topogeom-1',
   topology.ST_NewEdgeHeal('t', 1, 2);
 SELECT 'unexpected-success-with-orphaned-point-topogeom-2',
   topology.ST_NewEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_poi RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
-WITH deleted AS (
-  DELETE FROM t.f_poi RETURNING g
-), clear AS (
-  SELECT ClearTopoGeom(g) FROM deleted
-) SELECT NULL FROM clear;
-
+-- Cannot heal edges connected by node used in collection TopoGeometry
+-- See https://trac.osgeo.org/postgis/ticket/3239
 INSERT INTO t.f_mix VALUES ('F+N1',
   topology.CreateTopoGeom('t', 4, 3, '{{1,1}}'));
-
--- This should be forbidden, as F+N1 above could not be
--- defined w/out the joining node
--- See https://trac.osgeo.org/postgis/ticket/3239
 SELECT 'unexpected-success-with-orphaned-mix-topogeom-1',
   topology.ST_NewEdgeHeal('t', 1, 2);
 SELECT 'unexpected-success-with-orphaned-mix-topogeom-2',
   topology.ST_NewEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_mix RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
-WITH deleted AS (
-  DELETE FROM t.f_mix RETURNING g
-), clear AS (
-  SELECT ClearTopoGeom(g) FROM deleted
-) SELECT NULL FROM clear;
-
+-- Cannot heal edges when only one is used in line TopoGeometry
+-- defined w/out one of the edges
 INSERT INTO t.f_lin VALUES ('F+E1',
   topology.CreateTopoGeom('t', 2, 1, '{{1,2}}'));
-
--- This should be forbidden, as F+E1 above could not be
--- defined w/out one of the edges
 SELECT topology.ST_NewEdgeHeal('t', 1, 2);
 SELECT topology.ST_NewEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_lin RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
+
+---- Cannot heal edges when only one is used in collection TopoGeometry
+---- defined w/out one of the edges
+INSERT INTO t.f_mix VALUES ('F+E1',
+  topology.CreateTopoGeom('t', 4, 3, '{{1,2}}'));
+SELECT topology.ST_NewEdgeHeal('t', 1, 2);
+SELECT topology.ST_NewEdgeHeal('t', 2, 1);
+WITH deleted AS ( DELETE FROM t.f_mix RETURNING g),
+     clear AS ( SELECT ClearTopoGeom(g) FROM deleted)
+     SELECT NULL FROM clear;
 
 -- This is for ticket #941
 SELECT topology.ST_NewEdgeHeal('t', 1, 200);
diff --git a/topology/test/regress/st_newedgeheal_expected b/topology/test/regress/st_newedgeheal_expected
index eb698a6..973f00f 100644
--- a/topology/test/regress/st_newedgeheal_expected
+++ b/topology/test/regress/st_newedgeheal_expected
@@ -108,6 +108,8 @@ ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1
 ERROR:  TopoGeom 1 in layer 3 (t.f_mix.g) cannot be represented removing node 1 connecting edges 2 and 1
 ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 1 and 2
 ERROR:  TopoGeom 1 in layer 1 (t.f_lin.g) cannot be represented healing edges 2 and 1
+ERROR:  TopoGeom 2 in layer 3 (t.f_mix.g) cannot be represented healing edges 1 and 2
+ERROR:  TopoGeom 2 in layer 3 (t.f_mix.g) cannot be represented healing edges 2 and 1
 ERROR:  SQL/MM Spatial exception - non-existent edge 200
 ERROR:  SQL/MM Spatial exception - non-existent edge 100
 E3

-----------------------------------------------------------------------

Summary of changes:
 topology/postgis_topology.c                   |  8 ++---
 topology/test/regress/st_modedgeheal.sql      | 44 ++++++++++++------------
 topology/test/regress/st_newedgeheal.sql      | 49 ++++++++++++++-------------
 topology/test/regress/st_newedgeheal_expected |  2 ++
 4 files changed, 55 insertions(+), 48 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list