[PostGIS] #6064: Silent topology corruption with topology.ST_AddEdgeModFace (was: Silent topology corruption with topology.TopoGeo_addLinestring)
PostGIS
trac at osgeo.org
Tue Apr 7 08:41:42 PDT 2026
#6064: Silent topology corruption with topology.ST_AddEdgeModFace
-----------------------+--------------------
Reporter: strk | Owner: strk
Type: defect | Status: new
Priority: medium | Milestone:
Component: topology | Version: master
Resolution: | Keywords:
-----------------------+--------------------
Changes (by strk):
* summary: Silent topology corruption with topology.TopoGeo_addLinestring
=> Silent topology corruption with topology.ST_AddEdgeModFace
Old description:
> As of commit [67ff872e2d4b8b46e6d412dae592e89480fc668c/git] a topology
> can be corrupted without exception by using TopoGeo_addLinestring.
>
> Test attached.
>
> This is a spin-off of #6062
>
> Full version:
> {{{
> POSTGIS="3.7.0dev 3.6.0rc2-417-g67ff872e2" [EXTENSION] PGSQL="180"
> GEOS="3.14.2dev-CAPI-1.20.5" PROJ="9.6.0 NETWORK_ENABLED=OFF
> URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
> DATABASE_PATH=/usr/share/proj/proj.db" (compiled against PROJ 9.6.0)
> LIBXML="2.9.14" LIBJSON="0.18" LIBPROTOBUF="1.5.1" WAGYU="0.5.0
> (Internal)" TOPOLOGY
> }}}
New description:
As of commit [67ff872e2d4b8b46e6d412dae592e89480fc668c/git] a topology can
be corrupted without exception by using ST_AddEdgeModFace.
Test attached.
This is a spin-off of #6062
Full version:
{{{
POSTGIS="3.7.0dev 3.6.0rc2-417-g67ff872e2" [EXTENSION] PGSQL="180"
GEOS="3.14.2dev-CAPI-1.20.5" PROJ="9.6.0 NETWORK_ENABLED=OFF
URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
DATABASE_PATH=/usr/share/proj/proj.db" (compiled against PROJ 9.6.0)
LIBXML="2.9.14" LIBJSON="0.18" LIBPROTOBUF="1.5.1" WAGYU="0.5.0
(Internal)" TOPOLOGY
}}}
--
Comment:
Further simplification of the test, completely removing the code that
takes care of noding. This one ONLY uses `ST_AddEdgeModFace`:
{{{
SELECT NULL FROM topology.CreateTopology ('t6064');
SELECT topology.ST_AddIsoNode('t6064', 0, 'POINT(17.42207545158684
69.11091383590066)'); -- n1
SELECT topology.ST_AddIsoNode('t6064', 0, 'POINT(17.622976580401446
69.12848944101118)'); -- n2
SELECT topology.ST_AddIsoNode('t6064', 0, 'POINT(17.42207545158653
69.11091383590062)'); -- n3
SELECT 't6064.1', count(*) FROM topology.ST_AddEdgeModFace('t6064',
1, 2,
'LINESTRING(
17.42207545158684 69.11091383590066,
17.422075702665087 69.11091383235977,
17.579930758184094 69.12294910230447,
17.622976580401446 69.12848944101118
)');
SELECT 't6064.2', count(*) FROM topology.ST_AddEdgeModFace('t6064',
3,1,
'LINESTRING(
17.42207545158653 69.11091383590062,
17.42207545158684 69.11091383590066
)');
-- valid thus far
-- Silently corrupts topology, updating edge 1 side faces as it thinks
-- left side is a new face (it isn't).
-- The code finds rings on BOTH sides of this new edge to be
counterclockwise
-- but instead only one side of them is.
--
-- This is likely due to the presence of very long dangling edges.
--
SELECT 't6064.3', count(*) FROM topology.ST_AddEdgeModFace('t6064',
1, 3,
'LINESTRING(
17.42207545158684 69.11091383590066,
17.42207570266477 69.11091383235974,
17.42207545158653 69.11091383590062
)'
);
}}}
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/6064#comment:7>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list