Problem
When using pgr_dijkstraVia, if one of the input nodes does not exist in the graph, the function throws the following error instead of handling the case gracefully.
SQL Error [XX000]: ERROR: std::bad_alloc
Hint:
from 170576 to 1
Where: SQL function "pgr_dijkstravia" statement 1
To Reproduce
SELECT * FROM pgr_dijkstraVia(
'SELECT id, source, target, cost, reverse_cost FROM edge_table',
ARRAY[170576, 1]
);
Where node 170576 does not exist in the graph.
Expectation
The function should return an empty result but should not throw std::bad_alloc.
Sample Data
Platform/versions
POSTGIS="3.5.3 3.5.3" [EXTENSION] PGSQL="160" GEOS="3.13.1-CAPI-1.19.2" PROJ="8.2.1 NETWORK_ENABLED=OFF URL_ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=C:\WINDOWS\ServiceProfiles\NetworkService\AppData\Local/proj DATABASE_PATH=C:\Program Files\PostgreSQL\16\share\contrib\postgis-3.5\proj\proj.db" (compiled against PROJ 8.2.1) GDAL="GDAL 3.9.2, released 2024/08/13" LIBXML="2.12.5" LIBJSON="0.12" LIBPROTOBUF="1.2.1" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
Problem
When using
pgr_dijkstraVia, if one of the input nodes does not exist in the graph, the function throws the following error instead of handling the case gracefully.To Reproduce
Where node 170576 does not exist in the graph.
Expectation
The function should return an empty result but should not throw
std::bad_alloc.Sample Data
Platform/versions