[PostGIS] #5957: ST_GetFaceEdges return bigint in some cases
PostGIS
trac at osgeo.org
Mon Jul 28 00:15:56 PDT 2025
#5957: ST_GetFaceEdges return bigint in some cases
-------------------------------+---------------------------
Reporter: Lars Aksel Opsahl | Owner: strk
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.6.0
Component: topology | Version: master
Keywords: |
-------------------------------+---------------------------
On this version
{{{
PostgreSQL 16.4 (Ubuntu 16.4-1.pgdg22.04+1) on x86_64-pc-linux-gnu,
compiled by gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0, 64-bit
POSTGIS="3.6.0beta1 3.6.0beta1-10-ge0e19372b" [EXTENSION] PGSQL="160"
GEOS="3.13.1-CAPI-1.19.2" PROJ="9.3.0 NETWORK_ENABLED=OFF
URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj
DATABASE_PATH=/usr/local/share/proj/proj.db" (compiled against PROJ 9.3.0)
LIBXML="2.9.13" LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0
(Internal)" TOPOLOGY
}}}
I got this error message in one case.
{{{
NOTICE: Failed to run ST_GetFaceEdges for face_id 462 in topo
arstat_04_topo_72 state : 42804 message: structure of query does not
match function result type detail : Returned type bigint does not match
expected type integer in column 1. hint : context: SQL statement "
SELECT abs(t.edge) AS edge_id
FROM
topology.ST_GetFaceEdges('arstat_04_topo_72',462) As t(seq,edge);
"
}}}
This is the code I called it from
{{{
CREATE OR REPLACE FUNCTION topo_update.get_face_edges(_atopology varchar,
_face_id int)
RETURNS table(edge_id int)
AS $$
DECLARE
-- holds dynamic sql to be able to use the same code for different
command_string text;
v_state text;
v_msg text;
v_detail text;
v_hint text;
v_context text;
face_id_found boolean = false;
BEGIN
BEGIN
command_string = format($fmt$
SELECT abs(t.edge) AS edge_id
FROM topology.ST_GetFaceEdges(%1$L,%2$s) As
t(seq,edge);
$fmt$,
_atopology,
_face_id
);
RAISE NOTICE 'command_string %', command_string;
RETURN QUERY EXECUTE command_string;
EXCEPTION WHEN OTHERS THEN
GET STACKED DIAGNOSTICS v_state = RETURNED_SQLSTATE, v_msg
= MESSAGE_TEXT, v_detail = PG_EXCEPTION_DETAIL, v_hint =
PG_EXCEPTION_HINT,
v_context
= PG_EXCEPTION_CONTEXT;
RAISE NOTICE 'Failed to run ST_GetFaceEdges for face_id %
in topo % state : % message: % detail : % hint : % context: %',
_face_id, _atopology, v_state, v_msg, v_detail, v_hint,
v_context;
RETURN;
END;
END;
$$
LANGUAGE plpgsql
STABLE;
}}}
I am working on test case to reproduce this error, but so far I have only
seen this error one time and have not been able to reproduce it so far.
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5957>
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