[postgis-tickets] [PostGIS] #5548: ValidateTopology, failes with ERROR: XX000: GetRingEdges: edge id cannot be null
PostGIS
trac at osgeo.org
Mon Sep 25 03:33:09 PDT 2023
#5548: ValidateTopology, failes with ERROR: XX000: GetRingEdges: edge id cannot
be null
--------------------------------+---------------------------
Reporter: Lars Aksel Opsahl | Owner: strk
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.4.1
Component: topology | Version: 3.4.x
Resolution: | Keywords:
--------------------------------+---------------------------
Comment (by strk):
I got access to the database exposing the problem.
The offending query is from the step in which shells of all faces are
constructed
> NOTICE: Constructing geometry of all faces
In particular, this is the dynamic SQL being executed:
{{{
WITH
outside_point AS (
SELECT ST_Translate(
ST_StartPoint( ST_BoundingDiagonal(mbr) ),
-1,
-1
)
FROM topo.face
WHERE face_id = $1
),
leftmost_edge AS (
SELECT
CASE WHEN left_face = $1
THEN
edge_id
ELSE
-edge_id
END ring_id
FROM topo.edge
WHERE left_face = $1 or right_face = $1
ORDER BY
geom <-> $2
LIMIT 1
),
edgering AS (
SELECT *
FROM
GetRingEdges(
'topo',
(SELECT ring_id FROM leftmost_edge)
)
)
SELECT
ST_MakeLine(
CASE WHEN r.edge > 0 THEN
e.geom
ELSE
ST_Reverse(e.geom)
END
ORDER BY r.sequence
) outerRing
FROM edgering r, topo.edge e
WHERE e.edge_id = abs(r.edge)
}}}
The GetRingEdges function evidently receives a NULL, so `SELECT ring_id
FROM leftmost_edge` returns NULL. The leftmost_edge CTE is:
{{{
SELECT
CASE WHEN left_face = $1
THEN
edge_id
ELSE
-edge_id
END ring_id
FROM topo.edge
WHERE left_face = $1 or right_face = $1
ORDER BY
geom <-> $2
LIMIT 1
}}}
Getting a NULL from that query suggests that the face with id=$1 has no
edges.
I'm digging further.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5548#comment:2>
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