[postgis-tickets] [SCM] PostGIS branch master updated. 3.1.0rc1-41-g1708888

git at osgeo.org git at osgeo.org
Mon Jan 11 07:36:16 PST 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, master has been updated
       via  17088887c6df99a0e94f362f11371c92aada8720 (commit)
      from  d6fd9521b664be6e94102d1e4c778eaa85a2fb05 (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 17088887c6df99a0e94f362f11371c92aada8720
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Jan 11 16:34:15 2021 +0100

    Fix ValidateTopology check for node containing_face
    
    Update pre-existing testcase which did contain an invalid
    node's containing_face
    References #3233

diff --git a/topology/test/regress/legacy_invalid_expected b/topology/test/regress/legacy_invalid_expected
index 5fc633a..e47d167 100644
--- a/topology/test/regress/legacy_invalid_expected
+++ b/topology/test/regress/legacy_invalid_expected
@@ -18,4 +18,5 @@ face without edges|10|
 face has no rings|10|
 face within face|11|2
 face overlaps face|2|12
+not-isolated node has not-null containing_face|4|
 Topology 'invalid_topology' dropped
diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index e1d60bc..2943854 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -1671,22 +1671,35 @@ BEGIN
   -- Check nodes have correct containing_face (#3233)
   FOR rec IN EXECUTE format(
     $SQL$
-      SELECT n.node_id, f.face_id, e.edge_id
+
+      SELECT
+        n.node_id,
+        -- in a corrupted topology multiple faces may contain the node
+        min(f.face_id) face_id,
+        -- multiple edges may contain the node
+        min(e.edge_id) edge_id
+
       FROM %1$I.node n
       LEFT JOIN face_check f ON ( ST_Contains(f.geom, n.geom) )
       LEFT JOIN %1$I.edge e ON (
         ST_Equals(ST_StartPoint(e.geom), n.geom) OR
         ST_Equals(ST_EndPoint(e.geom), n.geom)
       )
+
       WHERE
-       n.containing_face != f.face_id
-        OR
-       ( n.containing_face IS NULL AND f.face_id IS NOT NULL )
-        OR
-       ( n.containing_face IS NOT NULL AND e.edge_id IS NOT NULL )
+       (
+         e.edge_id IS NULL AND (
+          n.containing_face != f.face_id
+          OR ( n.containing_face IS NULL AND f.face_id IS NOT NULL )
+         )
+       )
+       OR ( n.containing_face IS NOT NULL AND e.edge_id IS NOT NULL )
+
+      GROUP BY n.node_id, n.containing_face
     $SQL$, toponame)
   LOOP
     IF rec.edge_id IS NOT NULL THEN
+      -- node is not really isolated
       retrec.error := 'not-isolated node has not-null containing_face';
     ELSE
       retrec.error := 'isolated node has wrong containing_face';

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

Summary of changes:
 topology/test/regress/legacy_invalid_expected |  1 +
 topology/topology.sql.in                      | 25 +++++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list