[SCM] PostGIS branch stable-3.2 updated. 3.2.7-18-gf898c2bf6

git at osgeo.org git at osgeo.org
Fri Oct 11 12:43:04 PDT 2024


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.2 has been updated
       via  f898c2bf6c73e9611111744dbaa5d4c9ff9b78e6 (commit)
      from  fa7431dcf4be47a20542922c6bc4a7a2215aa8af (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 f898c2bf6c73e9611111744dbaa5d4c9ff9b78e6
Author: Björn Harrtell <bjorn at septima.dk>
Date:   Thu Oct 10 14:46:49 2024 +0200

    Fix ST_NewEdgesSplit can cause invalid topology
    
    References #5795 in 3.2 branch (3.2.8dev)
    Includes testcase

diff --git a/NEWS b/NEWS
index 9abd1161b..f71fcfd7f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,9 @@
-PostGIS 3.2.8
+PostGIS 3.2.8dev
 2024/xx/xx
 
 * Bug Fixes  *
 
+ - #5795, Fix ST_NewEdgesSplit can cause invalid topology (Björn Harrtell)
  - #5677, ST_Union(geom[]) should unary union single entry arrays (Paul Ramsey)
  - #5589, ST_3DDistance error for shared first point (Paul Ramsey)
  - #5686, ST_NumInteriorRings and Triangle crash (Paul Ramsey)
diff --git a/liblwgeom/lwgeom_topo.c b/liblwgeom/lwgeom_topo.c
index 11585cd13..a84e250ca 100644
--- a/liblwgeom/lwgeom_topo.c
+++ b/liblwgeom/lwgeom_topo.c
@@ -1334,7 +1334,7 @@ lwt_NewEdgesSplit( LWT_TOPOLOGY* topo, LWT_ELEMID edge,
 
   /* Update all next edge references pointing to old edge id */
 
-  updedge.next_right = newedges[1].edge_id;
+  updedge.next_right = newedges[0].edge_id;
   seledge.next_right = edge;
   seledge.start_node = oldedge->start_node;
   ret = lwt_be_updateEdges(topo,
@@ -1348,7 +1348,7 @@ lwt_NewEdgesSplit( LWT_TOPOLOGY* topo, LWT_ELEMID edge,
     return -1;
   }
 
-  updedge.next_right = -newedges[0].edge_id;
+  updedge.next_right = -newedges[1].edge_id;
   seledge.next_right = -edge;
   seledge.start_node = oldedge->end_node;
   ret = lwt_be_updateEdges(topo,
diff --git a/topology/test/regress/st_newedgessplit.sql b/topology/test/regress/st_newedgessplit.sql
index abaeafd97..e17587fd5 100644
--- a/topology/test/regress/st_newedgessplit.sql
+++ b/topology/test/regress/st_newedgessplit.sql
@@ -143,3 +143,33 @@ DROP TABLE t;
 
 DROP FUNCTION check_changes();
 SELECT DropTopology('city_data');
+
+select '---';
+
+-- Regression test for ST_NewEdgesSplit can cause invalid topology
+-- See https://trac.osgeo.org/postgis/ticket/5795
+select '#5795|Regression test starting';
+select '#5795|Create t5795' from (select null from topology.createtopology('t5795', 0, 0)) q;
+select '#5795|N' || topology.st_addisonode('t5795', 0, st_geomfromtext('POINT(0 0)'));
+select '#5795|N' || topology.st_addisonode('t5795', 0, st_geomfromtext('POINT(10 10)'));
+select '#5795|E' || topology.st_addisoedge('t5795', 1, 2, st_geomfromtext('LINESTRING(0 0, 10 0, 10 10)'));
+select '#5795|E' || topology.st_addedgenewfaces('t5795', 2, 1, st_geomfromtext('LINESTRING(10 10, 0 10, 0 0)'));
+select '#5795|N' || topology.st_newedgessplit('t5795', 1, st_geomfromtext('POINT(5 0)'));
+select '#5795|E' || edge_id, next_left_edge, next_right_edge, left_face, right_face from t5795.edge_data order by edge_id;
+select '#5795|V1' ||topology.validatetopology('t5795');
+select '#5795|N' || topology.st_newedgessplit('t5795', 4, st_geomfromtext('POINT(10 5)'));
+select '#5795|E' || edge_id, next_left_edge, next_right_edge, left_face, right_face from t5795.edge_data order by edge_id;
+select '#5795|V2' ||topology.validatetopology('t5795');
+select '#5795|E' || topology.st_addedgenewfaces('t5795', 3, 4, st_geomfromtext('LINESTRING(5 0, 10 5)'));
+select '#5795|E' || edge_id, next_left_edge, next_right_edge, left_face, right_face from t5795.edge_data order by edge_id;
+select '#5795|V3' ||topology.validatetopology('t5795');
+select '#5795|N' || topology.st_newedgessplit('t5795', 7, st_geomfromtext('POINT(7.5 2.5)'));
+select '#5795|E' || edge_id, next_left_edge, next_right_edge, left_face, right_face from t5795.edge_data order by edge_id;
+select '#5795|V4' ||topology.validatetopology('t5795');
+select '#5795|N' || topology.st_newedgessplit('t5795', 5, st_geomfromtext('POINT(10 2.5)'));
+select '#5795|E' || edge_id, next_left_edge, next_right_edge, left_face, right_face from t5795.edge_data order by edge_id;
+select '#5795|V5' || topology.validatetopology('t5795');
+select '#5795|E' || topology.st_addedgenewfaces('t5795', 5, 6, st_geomfromtext('LINESTRING(7.5 2.5, 10 2.5)'));
+select topology.validatetopology('t5795');
+select '#5795|Drop t5795' from (select null from topology.droptopology('t5795')) q;
+select '#5795|Regression test finished';
diff --git a/topology/test/regress/st_newedgessplit_expected b/topology/test/regress/st_newedgessplit_expected
index d02e0bee0..9d9d4abfd 100644
--- a/topology/test/regress/st_newedgessplit_expected
+++ b/topology/test/regress/st_newedgessplit_expected
@@ -36,3 +36,43 @@ seq_reset|1|1|1
 robust.1|E1|N3
 robust.2|t|t
 Topology 'city_data' dropped
+---
+#5795|Regression test starting
+#5795|Create t5795
+#5795|N1
+#5795|N2
+#5795|E1
+#5795|E2
+#5795|N3
+#5795|E2|3|-4|1|0
+#5795|E3|4|-2|1|0
+#5795|E4|2|-3|1|0
+#5795|N4
+#5795|E2|3|-6|1|0
+#5795|E3|5|-2|1|0
+#5795|E5|6|-3|1|0
+#5795|E6|2|-5|1|0
+#5795|E7
+#5795|E2|3|-6|3|0
+#5795|E3|7|-2|3|0
+#5795|E5|-7|-3|2|0
+#5795|E6|2|-5|3|0
+#5795|E7|6|5|3|2
+#5795|N5
+#5795|E2|3|-6|3|0
+#5795|E3|8|-2|3|0
+#5795|E5|-9|-3|2|0
+#5795|E6|2|-5|3|0
+#5795|E8|9|5|3|2
+#5795|E9|6|-8|3|2
+#5795|N6
+#5795|E2|3|-6|3|0
+#5795|E3|8|-2|3|0
+#5795|E6|2|-11|3|0
+#5795|E8|9|10|3|2
+#5795|E9|6|-8|3|2
+#5795|E10|11|-3|2|0
+#5795|E11|-9|-10|2|0
+#5795|E12
+#5795|Drop t5795
+#5795|Regression test finished

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

Summary of changes:
 NEWS                                            |  3 +-
 liblwgeom/lwgeom_topo.c                         |  4 +--
 topology/test/regress/st_newedgessplit.sql      | 30 +++++++++++++++++++
 topology/test/regress/st_newedgessplit_expected | 40 +++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list