Skip to content

Commit

Permalink
Fix #2565 Returning empty results when vertex does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Sep 25, 2023
1 parent 579eaed commit 72e368b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Changes on the documentation to the following:

* using bootstrap_version 2 because 3+ does not do dropdowns

**Issue fixes**

* [#2565](https://github.com/pgRouting/pgrouting/issues/2565)
pgr_pgr_lengauerTarjanDominatorTree triggers an assertion

**SQL enhancements**

* [#2561](https://github.com/pgRouting/pgrouting/issues/2561) Not use
Expand Down
5 changes: 5 additions & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ Changes on the documentation to the following:

* using bootstrap_version 2 because 3+ does not do dropdowns

.. rubric:: Issue fixes

* `#2565 <https://github.com/pgRouting/pgrouting/issues/2565>`__
pgr_pgr_lengauerTarjanDominatorTree triggers an assertion

.. rubric:: SQL enhancements

* `#2561 <https://github.com/pgRouting/pgrouting/issues/2561>`__ Not use
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Pgr_LTDTree : public pgrouting::Pgr_messages {
int64_t root
){
std::vector<II_t_rt> results;
if (!graph.has_vertex(root)) return results;
std::vector<int64_t> idoms = std::vector<int64_t>(boost::num_vertices(graph.graph), -1);
auto dominatorTree =
make_iterator_property_map
Expand Down
14 changes: 10 additions & 4 deletions pgtap/dominator/lengauerTarjanDominatorTree/edge_cases.pg
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
********************************************************************PGR-GNU*/
BEGIN;
UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost);
SELECT CASE WHEN NOT min_version('3.2.0') THEN plan(1) ELSE plan(11) END;
SELECT CASE WHEN NOT min_version('3.2.0') THEN plan(1) ELSE plan(12) END;

CREATE OR REPLACE FUNCTION edge_cases()
RETURNS SETOF TEXT AS
Expand Down Expand Up @@ -63,16 +63,22 @@ WHERE id = 1;
RETURN QUERY
SELECT set_eq('q2', $$VALUES (1, 5, 5, 1, 1)$$, 'graph2: u<->u');

/*
PERFORM todo('triggers an assertion when the vertex does not exist', 1);
IF min_version('3.5.1') THEN

PREPARE ltd_test2_1 AS
SELECT *
FROM pgr_lengauerTarjanDominatorTree(
'q2',6
);
RETURN QUERY
SELECT lives_ok('ltd_test2_1', 'test2: Triggers an assertion');
*/

ELSE

RETURN QUERY
SELECT skip(1, 'triggers an assertion when the vertex does not exist');

END IF;

PREPARE ltd_test2 AS
SELECT *
Expand Down

0 comments on commit 72e368b

Please sign in to comment.