From 0cbf7e4c97ba4c445872f32f2d24e38767726804 Mon Sep 17 00:00:00 2001 From: Ronan Dunklau Date: Wed, 6 Nov 2024 16:47:55 +0100 Subject: [PATCH 1/8] Fix requires The postgresl control file parser do not add up multiple occurences of the same keyword. In practice it's not a big deal as plpgsql is installed by default. (cherry picked from commit d5376afd445edb5582389b4ba88018690250b7b9) --- sql/common/pgrouting.control | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sql/common/pgrouting.control b/sql/common/pgrouting.control index 5b6ddcf1dfd..7461bdd0828 100644 --- a/sql/common/pgrouting.control +++ b/sql/common/pgrouting.control @@ -3,5 +3,4 @@ comment = 'pgRouting Extension' default_version = '${PROJECT_VERSION}' module_pathname = '${PROJECT_MODULE_PATHNAME}' relocatable = true -requires = 'plpgsql' -requires = 'postgis' +requires = 'plpgsql,postgis' From a0b6781ff4d807bb327b8f37ae470822bdc66905 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Thu, 21 Nov 2024 13:45:48 -0600 Subject: [PATCH 2/8] fix version --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7c818398a7..e06dbff9464 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,7 +20,7 @@ include(pgr/BuildType) project(PGROUTING VERSION 4.0.0 LANGUAGES C CXX ) -set(PROJECT_VERSION_DEV "") +set(PROJECT_VERSION_DEV "-dev") string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER) include(pgr/GitInfo) From f158ed7625d4e19419243182847b19285c5ff925 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Thu, 21 Nov 2024 13:46:28 -0600 Subject: [PATCH 3/8] Fix index pointer of latest release notes --- doc/src/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/index.rst b/doc/src/index.rst index e3f8eee2180..f240d486cac 100644 --- a/doc/src/index.rst +++ b/doc/src/index.rst @@ -91,7 +91,7 @@ Available Functions but not official pgRouting functions .. include:: release_notes.rst :start-after: current - :end-before: pgRouting 3.6 + :end-before: pgRouting 3 All releases ------------------------------------------------------------------------------- From c121c45ef6236f368ac3f3f503e10f30e293084f Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 2 Oct 2024 17:23:05 -0600 Subject: [PATCH 4/8] [docqueries] Removing deprecated function pgr_trspViaEdges --- docqueries/src/migration.pg | 16 +- docqueries/src/migration.result | 68 ++----- docqueries/trsp/issue717.pg | 104 ---------- docqueries/trsp/issue717.result | 252 ------------------------ docqueries/trsp/trsp_vias-any-04.pg | 25 --- docqueries/trsp/trsp_vias-any-04.result | 89 --------- 6 files changed, 18 insertions(+), 536 deletions(-) diff --git a/docqueries/src/migration.pg b/docqueries/src/migration.pg index d332ab6d9c0..6748b4a9dce 100644 --- a/docqueries/src/migration.pg +++ b/docqueries/src/migration.pg @@ -156,10 +156,7 @@ WHERE edge != -1; SELECT pid, edge_id, fraction, side FROM pointsOfInterest WHERE pid IN (3, 4, 6); /* --edgesvia1 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true); +SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6); /* --edgesvia2 */ SELECT * FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, @@ -172,15 +169,10 @@ path_id::INTEGER AS id1, node::INTEGER AS id2, CASE WHEN edge >= 0 THEN edge::INTEGER ELSE -1 END AS id3, cost::FLOAT FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, - $$SELECT * FROM (VALUES (1, 6, 0.3),(2, 12, 0.6),(3, 4, 0.7)) AS t(pid, edge_id, fraction)$$, - ARRAY[-1, -2, -3], - details=> false); + $$SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6)$$, + ARRAY[-4, -3, -6], + details => false); /* --edgesvia4 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); /* --edgesvia5 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, diff --git a/docqueries/src/migration.result b/docqueries/src/migration.result index 93e5af8927e..c2bb11fa93c 100644 --- a/docqueries/src/migration.result +++ b/docqueries/src/migration.result @@ -404,26 +404,13 @@ WHERE pid IN (3, 4, 6); (3 rows) /* --edgesvia1 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 - 2 | 1 | 3 | 7 | 1 - 3 | 1 | 7 | 10 | 1 - 4 | 1 | 8 | 12 | 0.6 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 12 | 0.4 - 7 | 2 | 12 | 13 | 1 - 8 | 2 | 17 | 15 | 1 - 9 | 2 | 16 | 9 | 1 - 10 | 2 | 11 | 8 | 1 - 11 | 2 | 7 | 4 | 0.7 - 12 | 2 | -3 | -2 | 0 -(12 rows) +SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6); + pid | edge_id | fraction +-----+---------+---------- + 3 | 12 | 0.6 + 4 | 6 | 0.3 + 6 | 4 | 0.7 +(3 rows) /* --edgesvia2 */ SELECT * FROM pgr_withPointsVia( @@ -453,53 +440,26 @@ path_id::INTEGER AS id1, node::INTEGER AS id2, CASE WHEN edge >= 0 THEN edge::INTEGER ELSE -1 END AS id3, cost::FLOAT FROM pgr_withPointsVia( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, - $$SELECT * FROM (VALUES (1, 6, 0.3),(2, 12, 0.6),(3, 4, 0.7)) AS t(pid, edge_id, fraction)$$, - ARRAY[-1, -2, -3], - details=> false); + $$SELECT pid, edge_id, fraction FROM pointsOfInterest WHERE pid IN (3, 4, 6)$$, + ARRAY[-4, -3, -6], + details => false); seq | id1 | id2 | id3 | cost -----+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 + 1 | 1 | -4 | 6 | 0.7 2 | 1 | 3 | 7 | 1 3 | 1 | 7 | 10 | 1 4 | 1 | 8 | 12 | 0.6 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 12 | 0.4 + 5 | 1 | -3 | -1 | 0 + 6 | 2 | -3 | 12 | 0.4 7 | 2 | 12 | 13 | 1 8 | 2 | 17 | 15 | 1 9 | 2 | 16 | 9 | 1 10 | 2 | 11 | 8 | 1 11 | 2 | 7 | 4 | 0.3 - 12 | 2 | -3 | -1 | 0 + 12 | 2 | -6 | -1 | 0 (12 rows) /* --edgesvia4 */ -SELECT * FROM pgr_trspViaEdges( - $$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$, - ARRAY[6, 12, 4], ARRAY[0.3, 0.6, 0.7], - true, true, - $$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 6 | 0.7 - 2 | 1 | 3 | 7 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 9 | 1 - 5 | 1 | 16 | 16 | 1 - 6 | 1 | 15 | 3 | 1 - 7 | 1 | 10 | 2 | 1 - 8 | 1 | 6 | 4 | 1 - 9 | 1 | 7 | 10 | 1 - 10 | 1 | 8 | 12 | 1 - 11 | 2 | 12 | 13 | 1 - 12 | 2 | 17 | 15 | 1 - 13 | 2 | 16 | 9 | 1 - 14 | 2 | 11 | 8 | 1 - 15 | 2 | 7 | 4 | 0.3 -(15 rows) - /* --edgesvia5 */ SELECT * FROM pgr_trspVia_withPoints( $$SELECT id, source, target, cost, reverse_cost FROM edges$$, diff --git a/docqueries/trsp/issue717.pg b/docqueries/trsp/issue717.pg index a4a36282925..3f3da216fcc 100644 --- a/docqueries/trsp/issue717.pg +++ b/docqueries/trsp/issue717.pg @@ -30,33 +30,6 @@ SELECT * FROM pgr_trspViaVertices( true /* has_reverse_cost? */ ); -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); - - ------------------------------------- -- directed without reverse_cost ------------------------------------- @@ -67,32 +40,6 @@ SELECT * FROM pgr_trspViaVertices( false /* has_reverse_cost? */ ); -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); - ------------------------------------- @@ -105,32 +52,6 @@ SELECT * FROM pgr_trspViaVertices( true /* has_reverse_cost? */ ); -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); - ------------------------------------- -- undirected without reverse_cost @@ -142,28 +63,3 @@ SELECT * FROM pgr_trspViaVertices( false /* has_reverse_cost? */ ); -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); - - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); diff --git a/docqueries/trsp/issue717.result b/docqueries/trsp/issue717.result index c915a01ad37..494ff44f8b1 100644 --- a/docqueries/trsp/issue717.result +++ b/docqueries/trsp/issue717.result @@ -43,77 +43,6 @@ WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated fun 8 | 2 | 12 | -1 | 0 (8 rows) -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 4 | 0.5 - 2 | 1 | 7 | 7 | 1 - 3 | 1 | 3 | 6 | 0.5 - 4 | 1 | -2 | -1 | 0 - 5 | 2 | -2 | 6 | 0.5 - 6 | 2 | 3 | 7 | 1 - 7 | 2 | 7 | 8 | 1 - 8 | 2 | 11 | 11 | 0.5 - 9 | 2 | -3 | -2 | 0 -(9 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 12 | 13 | 1 - 8 | 2 | 17 | 15 | 1 - 9 | 2 | 16 | 9 | 1 - 10 | 2 | 11 | 8 | 1 - 11 | 2 | 7 | 7 | 1 - 12 | 2 | 3 | 6 | 0.5 - 13 | 2 | -3 | -2 | 0 -(13 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 12 | 13 | 1 - 8 | 2 | 17 | 15 | 1 - 9 | 2 | 16 | 9 | 1 - 10 | 2 | 11 | 8 | 1 - 11 | 2 | 7 | 7 | 1 - 12 | 2 | 3 | 6 | 0.5 - 13 | 2 | -3 | -2 | 0 -(13 rows) - SELECT * FROM pgr_trspViaVertices( 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', ARRAY[6, 1, 12]::INTEGER[], /* array of vids */ @@ -125,57 +54,6 @@ WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated fun -----+-----+-----+-----+------ (0 rows) -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 2 | -2 | 6 | 0.5 - 2 | 2 | 3 | 7 | 1 - 3 | 2 | 7 | 8 | 1 - 4 | 2 | 11 | 11 | 0.5 - 5 | 2 | -3 | -2 | 0 -(5 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -2 | 0 -(5 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -2 | 0 -(5 rows) - SELECT * FROM pgr_trspViaVertices( 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', ARRAY[6, 1, 12]::INTEGER[], /* array of vids */ @@ -195,71 +73,6 @@ WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated fun 8 | 2 | 12 | -1 | 0 (8 rows) -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 4 | 0.5 - 2 | 1 | 7 | 7 | 1 - 3 | 1 | 3 | 6 | 0.5 - 4 | 1 | -2 | -1 | 0 - 5 | 2 | -2 | 6 | 0.5 - 6 | 2 | 3 | 7 | 1 - 7 | 2 | 7 | 8 | 1 - 8 | 2 | 11 | 11 | 0.5 - 9 | 2 | -3 | -2 | 0 -(9 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 11 | 8 | 1 - 8 | 2 | 7 | 7 | 1 - 9 | 2 | 3 | 6 | 0.5 - 10 | 2 | -3 | -2 | 0 -(10 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - true /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 11 | 8 | 1 - 8 | 2 | 7 | 7 | 1 - 9 | 2 | 3 | 6 | 0.5 - 10 | 2 | -3 | -2 | 0 -(10 rows) - SELECT * FROM pgr_trspViaVertices( 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', ARRAY[6, 1, 12]::INTEGER[], /* array of vids */ @@ -279,70 +92,5 @@ WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated fun 8 | 2 | 12 | -1 | 0 (8 rows) -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 4 | 0.5 - 2 | 1 | 7 | 7 | 1 - 3 | 1 | 3 | 6 | 0.5 - 4 | 1 | -2 | -1 | 0 - 5 | 2 | -2 | 6 | 0.5 - 6 | 2 | 3 | 7 | 1 - 7 | 2 | 7 | 8 | 1 - 8 | 2 | 11 | 11 | 0.5 - 9 | 2 | -3 | -2 | 0 -(9 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 11 | 8 | 1 - 8 | 2 | 7 | 7 | 1 - 9 | 2 | 3 | 6 | 0.5 - 10 | 2 | -3 | -2 | 0 -(10 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - false, /* directed graph? */ - false /* has_reverse_cost? */ -); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 11 | 0.5 - 5 | 1 | -2 | -1 | 0 - 6 | 2 | -2 | 11 | 0.5 - 7 | 2 | 11 | 8 | 1 - 8 | 2 | 7 | 7 | 1 - 9 | 2 | 3 | 6 | 0.5 - 10 | 2 | -3 | -2 | 0 -(10 rows) - ROLLBACK; ROLLBACK diff --git a/docqueries/trsp/trsp_vias-any-04.pg b/docqueries/trsp/trsp_vias-any-04.pg index a25b8b5e6ae..35634c1fcdd 100644 --- a/docqueries/trsp/trsp_vias-any-04.pg +++ b/docqueries/trsp/trsp_vias-any-04.pg @@ -32,28 +32,3 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. true, /* has_reverse_cost? */ /* include the turn restrictions */ 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); - - SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); - SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); - SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); diff --git a/docqueries/trsp/trsp_vias-any-04.result b/docqueries/trsp/trsp_vias-any-04.result index 95eaebe8cb9..44eb152edf2 100644 --- a/docqueries/trsp/trsp_vias-any-04.result +++ b/docqueries/trsp/trsp_vias-any-04.result @@ -54,94 +54,5 @@ WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated fun 18 | 2 | 12 | -1 | 0 (18 rows) -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[4,6,11]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 4 | 0.5 - 2 | 1 | 7 | 8 | 1 - 3 | 1 | 11 | 9 | 1 - 4 | 1 | 16 | 16 | 1 - 5 | 1 | 15 | 3 | 1 - 6 | 1 | 10 | 5 | 1 - 7 | 1 | 11 | 8 | 1 - 8 | 1 | 7 | 7 | 1 - 9 | 1 | 3 | 6 | 1 - 10 | 2 | 3 | 7 | 1 - 11 | 2 | 7 | 8 | 1 - 12 | 2 | 11 | 9 | 1 - 13 | 2 | 16 | 16 | 1 - 14 | 2 | 15 | 3 | 1 - 15 | 2 | 10 | 5 | 1 - 16 | 2 | 11 | 11 | 0.5 -(16 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 9 | 1 - 5 | 1 | 16 | 16 | 1 - 6 | 1 | 15 | 3 | 1 - 7 | 1 | 10 | 5 | 1 - 8 | 1 | 11 | 11 | 1 - 9 | 2 | 12 | 13 | 1 - 10 | 2 | 17 | 15 | 1 - 11 | 2 | 16 | 9 | 1 - 12 | 2 | 11 | 8 | 1 - 13 | 2 | 7 | 7 | 1 - 14 | 2 | 3 | 6 | 0.5 -(14 rows) - -SELECT * FROM pgr_trspViaEdges( - 'SELECT id::INTEGER, source::INTEGER, target::INTEGER,cost, reverse_cost FROM edges', - ARRAY[1,11,6]::INTEGER[], /* array of eids */ - ARRAY[0.5, 0.5, 0.5]::float8[], /* array of vids */ - true, /* directed graph? */ - true, /* has_reverse_cost? */ - /* include the turn restrictions */ - 'SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions'); -WARNING: pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 -WARNING: pgr_trsp(text,integer,float,integer,float,boolean,boolean) deprecated signature on v3.4.0 - seq | id1 | id2 | id3 | cost ------+-----+-----+-----+------ - 1 | 1 | -1 | 1 | 0.5 - 2 | 1 | 6 | 4 | 1 - 3 | 1 | 7 | 8 | 1 - 4 | 1 | 11 | 9 | 1 - 5 | 1 | 16 | 16 | 1 - 6 | 1 | 15 | 3 | 1 - 7 | 1 | 10 | 5 | 1 - 8 | 1 | 11 | 11 | 1 - 9 | 2 | 12 | 13 | 1 - 10 | 2 | 17 | 15 | 1 - 11 | 2 | 16 | 9 | 1 - 12 | 2 | 11 | 8 | 1 - 13 | 2 | 7 | 7 | 1 - 14 | 2 | 3 | 6 | 0.5 -(14 rows) - ROLLBACK; ROLLBACK From 263b184189c5e01954ff7be99784b3e210b9af87 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 2 Oct 2024 17:36:42 -0600 Subject: [PATCH 5/8] [pgtap] Removing deprecated function pgr_trspViaEdges --- pgtap/trsp/trspViaEdges/inner_query.pg | 62 ---------- pgtap/trsp/trspViaEdges/no_crash_test.pg | 140 ----------------------- pgtap/trsp/trspViaEdges/types_check.pg | 45 -------- pgtap/trsp/trsp_withpoints/issue2575.sql | 105 +++++++++++++++++ 4 files changed, 105 insertions(+), 247 deletions(-) delete mode 100644 pgtap/trsp/trspViaEdges/inner_query.pg delete mode 100644 pgtap/trsp/trspViaEdges/no_crash_test.pg delete mode 100644 pgtap/trsp/trspViaEdges/types_check.pg create mode 100644 pgtap/trsp/trsp_withpoints/issue2575.sql diff --git a/pgtap/trsp/trspViaEdges/inner_query.pg b/pgtap/trsp/trspViaEdges/inner_query.pg deleted file mode 100644 index 9006c9ab2d7..00000000000 --- a/pgtap/trsp/trspViaEdges/inner_query.pg +++ /dev/null @@ -1,62 +0,0 @@ - -/*PGR-GNU***************************************************************** - -Copyright (c) 2018 pgRouting developers -Mail: project@pgrouting.org - ------- -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ********************************************************************PGR-GNU*/ -BEGIN; - --- This test is prepared for when: --- Tentatively trsp will accepts ANY-INTEGER and ANY-NUMERICAL on 4.0.0 --- Adjust style_dijkstra_trsp -> style_dijkstra when that happens - -UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); -SELECT plan(324); -SET client_min_messages TO ERROR; - -CREATE OR REPLACE FUNCTION inner_query() -RETURNS SETOF TEXT AS -$BODY$ -DECLARE - restriction TEXT; -BEGIN - - restriction := '$$SELECT 100::float AS to_cost, 25::INTEGER AS target_id, ''32, 33''::TEXT AS via_path$$)'; - - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, true)', TRUE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, true, NULL)', TRUE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, true, ' || restriction, TRUE); - - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, true)', TRUE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, true, NULL)', TRUE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, true, ' || restriction, TRUE); - - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, false)', FALSE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, false, NULL)', FALSE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], true, false, ' || restriction, FALSE); - - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, false)', FALSE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, false, NULL)', FALSE); - RETURN QUERY SELECT style_dijkstra_trsp('pgr_trspViaEdges', ', ARRAY[4,9,15]::INTEGER[], ARRAY[0.5, 0.5, 0.5]::FLOAT[], false, false, ' || restriction, FALSE); - -END; -$BODY$ -LANGUAGE plpgsql; - -SELECT inner_query(); - -SELECT finish(); -ROLLBACK; diff --git a/pgtap/trsp/trspViaEdges/no_crash_test.pg b/pgtap/trsp/trspViaEdges/no_crash_test.pg deleted file mode 100644 index 25adf2ceb63..00000000000 --- a/pgtap/trsp/trspViaEdges/no_crash_test.pg +++ /dev/null @@ -1,140 +0,0 @@ - -/*PGR-GNU***************************************************************** - -Copyright (c) 2018 pgRouting developers -Mail: project@pgrouting.org - ------- -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -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 min_version('4.0.1') THEN plan(22) ELSE plan(21) END; -SET client_min_messages TO ERROR; - -PREPARE null_ret AS -SELECT id FROM vertices WHERE id IN (-1); - - -CREATE OR REPLACE FUNCTION test(params TEXT[], subs TEXT[]) -RETURNS SETOF TEXT AS -$BODY$ -DECLARE -mp TEXT[]; -q1 TEXT; -q TEXT; -BEGIN - FOR i IN 0..array_length(params, 1) LOOP - mp := params; - IF i != 0 THEN - mp[i] = subs[i]; - END IF; - - q1 := format($$ - SELECT * FROM pgr_trspViaEdges( - %1$L, %2$s, %3$s, %4$s, %5$s - ) - $$, - mp[1], mp[2], mp[3], mp[4], mp[5] - ); - - if i IN (1,3) THEN - RETURN query SELECT * FROM throws_ok(q1); - ELSE - RETURN query SELECT * FROM lives_ok(q1, 'should live i ' || i); - RETURN query SELECT * FROM is_empty(q1, 'should be empty i' || i); - END IF; - - END LOOP; - -END -$BODY$ -LANGUAGE plpgsql VOLATILE; - -CREATE OR REPLACE FUNCTION test_function() -RETURNS SETOF TEXT AS -$BODY$ -DECLARE -params TEXT[]; -subs TEXT[]; -BEGIN - IF min_version('4.0.1') THEN - - RETURN QUERY SELECT isnt_empty('edges', 'Should not be empty to tests be meaningful'); - RETURN QUERY SELECT is_empty('null_ret', 'Should be empty to tests be meaningful'); - - params = ARRAY['$$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost::FLOAT, reverse_cost::FLOAT FROM edges$$', - 'ARRAY[1, 2]', - 'ARRAY[0.5, 0.5]::FLOAT[]', - 'true', - 'true' - ]::TEXT[]; - subs = ARRAY[ - 'NULL', - '(SELECT array_agg(id)::INTEGER[] FROM vertices WHERE id IN (-1))', - 'NULL::FLOAT[]', - 'NULL', - 'NULL' - ]::TEXT[]; - RETURN query SELECT no_crash_test('pgr_trspViaEdges', params, subs); - - subs = ARRAY[ - 'NULL', - 'NULL::INTEGER[]', - 'NULL::FLOAT[]', - 'NULL', - 'NULL' - ]::TEXT[]; - RETURN query SELECT no_crash_test('pgr_trspViaEdges', params, subs); - - ELSE - - params = ARRAY['SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost::FLOAT, reverse_cost::FLOAT FROM edges', - 'ARRAY[1]', - 'ARRAY[1.5]::FLOAT[]', - 'true', - 'true' - ]::TEXT[]; - subs = ARRAY[ - NULL, - '(SELECT array_agg(id)::INTEGER[] FROM vertices WHERE id IN (-1))', - 'NULL::FLOAT[]', - 'NULL', - 'NULL' - ]::TEXT[]; - - RETURN query SELECT test(params, subs); - - subs = ARRAY[ - NULL, - 'NULL::INTEGER[]', - 'NULL::FLOAT[]', - 'NULL', - 'NULL' - ]::TEXT[]; - RETURN query SELECT test(params, subs); - - RETURN QUERY SELECT skip(1, 'pgr_trspViaEdges Has some crashes'); - - END IF; - -END -$BODY$ -LANGUAGE plpgsql VOLATILE; - - -SELECT test_function(); - -SELECT finish(); -ROLLBACK; diff --git a/pgtap/trsp/trspViaEdges/types_check.pg b/pgtap/trsp/trspViaEdges/types_check.pg deleted file mode 100644 index 632cda71f8b..00000000000 --- a/pgtap/trsp/trspViaEdges/types_check.pg +++ /dev/null @@ -1,45 +0,0 @@ - -/*PGR-GNU***************************************************************** - -Copyright (c) 2018 pgRouting developers -Mail: project@pgrouting.org - ------- -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - ********************************************************************PGR-GNU*/ - -BEGIN; - -SELECT plan(5); - -SELECT has_function('pgr_trspviaedges'); - -SELECT has_function('pgr_trspviaedges', ARRAY['text','integer[]','double precision[]','boolean','boolean','text']); - -SELECT function_returns('pgr_trspviaedges', ARRAY['text','integer[]','double precision[]','boolean','boolean','text'],'setof record'); - - -SELECT set_eq( - $$SELECT proargnames from pg_proc where proname = 'pgr_trspviaedges'$$, - $$VALUES - ('{"","","","","","turn_restrict_sql","seq","id1","id2","id3","cost"}'::TEXT[]) - $$); - -SELECT set_eq( - $$SELECT proallargtypes from pg_proc where proname = 'pgr_trspviaedges'$$, - $$VALUES - ('{25,1007,1022,16,16,25,23,23,23,23,701}'::OID[]) - $$); - -SELECT finish(); -ROLLBACK; diff --git a/pgtap/trsp/trsp_withpoints/issue2575.sql b/pgtap/trsp/trsp_withpoints/issue2575.sql new file mode 100644 index 00000000000..59c824a0afa --- /dev/null +++ b/pgtap/trsp/trsp_withpoints/issue2575.sql @@ -0,0 +1,105 @@ + +/*PGR-GNU***************************************************************** + +Copyright (c) 2018 pgRouting developers +Mail: project@pgrouting.org + +------ +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ********************************************************************PGR-GNU*/ +BEGIN; + +SELECT plan(3); + +-- Create network table +CREATE TABLE railroad ( + id serial, + source integer, + target integer, + cost double precision, + reverse_cost double precision, + x1 double precision, + y1 double precision, + x2 double precision, + y2 double precision, + the_geom geometry +); + +-- Create restrictions table +CREATE TABLE restrictions_railroad ( + id serial, + cost FLOAT, + path BIGINT[] +); + +-- Populate network table +INSERT INTO railroad (x1,y1,x2,y2) VALUES + (0,0,1,0),(1,0,4,0),(4,0,5,0),(5,0,5,5),(5,5,0,5),(0,5,0,0), + (1,0,2,1),(2,1,3,1),(3,1,4,0) +; + +UPDATE railroad SET the_geom = ST_makeline(ST_point(x1,y1),ST_point(x2,y2)); +UPDATE railroad SET cost = ST_length(the_geom), reverse_cost = ST_length(the_geom); +SELECT pgr_createTopology('railroad',0.001); + +INSERT INTO restrictions_railroad (cost, path) +VALUES (100, ARRAY[9,2]),(100, ARRAY[2,9]),(100, ARRAY[7,2]),(100, ARRAY[2,7]); + +PREPARE dijkstra AS +SELECT seq, path_seq, node, edge, cost, agg_cost +FROM pgr_dijkstra('SELECT * FROM railroad', 4, 1); + +SELECT set_eq('dijkstra', $$VALUES + (1, 1, 4, 3, 1, 0), + (2, 2, 3, 2, 3, 1), + (3, 3, 2, 1, 1, 4), + (4, 4, 1,-1, 0, 5) + $$, 'expected dijkstra'); + +PREPARE between2nodes AS +SELECT seq, path_seq, node, edge, cost, agg_cost +FROM pgr_withPoints( + $$SELECT id, source, target, cost, reverse_cost FROM railroad$$, + $$SELECT * FROM (VALUES (1, 2, 0.75),(2, 8, 0.5)) AS t(pid, edge_id, fraction)$$, + -1, -2); + +SELECT set_eq('between2nodes', $$VALUES + (1, 1, -1, 2, 0.75, 0), + (2, 2, 3, 9, 1.4142135623730951, 0.75), + (3, 3, 8, 8, 0.5, 2.164213562373095), + (4, 4, -2,-1, 0, 2.664213562373095) + $$, 'expected withPoints'); + +PREPARE between2nodeswithRestriction AS +SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost +FROM pgr_trsp_withPoints( + $$SELECT id, source, target, cost, reverse_cost FROM railroad$$, + $$SELECT * FROM restrictions_railroad$$, + $$SELECT * FROM (VALUES (1, 2, 0.75),(2, 8, 0.5)) AS t(pid, edge_id, fraction)$$, + -1, -2); +SELECT set_eq('between2nodeswithRestriction', $$VALUES + (1, 1, -1, -2, -1, 2, 0.75, 0), + (2, 2, -1, -2, 3, 3, 1, 0.75), + (3, 3, -1, -2, 4, 4, 5, 1.75), + (4, 4, -1, -2, 5, 5, 5, 6.75), + (5, 5, -1, -2, 6, 6, 5, 11.75), + (6, 6, -1, -2, 1, 1, 1, 16.75), + (7, 7, -1, -2, 2, 7, 1.4142135623730958, 17.75), + (8, 8, -1, -2, 7, 8, 0.5, 19.164213562373096), + (9, 9, -1, -2, -2,-1, 0, 19.664213562373096) + $$, 'expected withPoints'); + +SELECT finish(); +ROLLBACK; + + From 3c677eff88828bcc2da42eb2b46a533269aed6d9 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 2 Oct 2024 17:38:00 -0600 Subject: [PATCH 6/8] [sql] Removing deprecated function pgr_trspViaEdges --- sql/sigs/pgrouting--4.0.sig | 1 - sql/trsp/CMakeLists.txt | 3 +- sql/trsp/trspViaEdges_deprecated.sql | 178 --------------------------- 3 files changed, 1 insertion(+), 181 deletions(-) delete mode 100644 sql/trsp/trspViaEdges_deprecated.sql diff --git a/sql/sigs/pgrouting--4.0.sig b/sql/sigs/pgrouting--4.0.sig index 460e9e69d68..d615be1533d 100644 --- a/sql/sigs/pgrouting--4.0.sig +++ b/sql/sigs/pgrouting--4.0.sig @@ -284,7 +284,6 @@ pgr_trsp(text,text,bigint,bigint,boolean) pgr_trsp(text,text,text,boolean) _pgr_trspv4(text,text,anyarray,anyarray,boolean) _pgr_trspv4(text,text,text,boolean) -pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text) _pgr_trspvia(text,text,anyarray,boolean,boolean,boolean) pgr_trspvia(text,text,anyarray,boolean,boolean,boolean) pgr_trspviavertices(text,anyarray,boolean,boolean,text) diff --git a/sql/trsp/CMakeLists.txt b/sql/trsp/CMakeLists.txt index c2b60d62eed..1f57396dfaa 100644 --- a/sql/trsp/CMakeLists.txt +++ b/sql/trsp/CMakeLists.txt @@ -9,9 +9,8 @@ SET(LOCAL_FILES _trspViaVertices_deprecated.sql trspViaVertices_deprecated.sql - trspViaEdges_deprecated.sql - _trsp_withPoints.sql trsp_withPoints.sql + _trsp_withPoints.sql trspVia.sql _trspVia.sql diff --git a/sql/trsp/trspViaEdges_deprecated.sql b/sql/trsp/trspViaEdges_deprecated.sql deleted file mode 100644 index 3bb7028dbfb..00000000000 --- a/sql/trsp/trspViaEdges_deprecated.sql +++ /dev/null @@ -1,178 +0,0 @@ -/*PGR-GNU***************************************************************** -File: trspViaEdges_deprecated.sql - -Copyright (c) 2015 pgRouting developers -Mail: project@pgrouting.org - ------- - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - ********************************************************************PGR-GNU*/ - - ---v3.0 -CREATE FUNCTION pgr_trspViaEdges( - text, -- SQL (required) - integer[], -- eids (required) - FLOAT[], -- pcts (required) - BOOLEAN, -- directed (required) - BOOLEAN, -- has_rcost (requierd) - - turn_restrict_sql text DEFAULT NULL::text, - - OUT seq INTEGER, - OUT id1 INTEGER, - OUT id2 INTEGER, - OUT id3 INTEGER, - OUT cost FLOAT -) -RETURNS SETOF RECORD AS -$body$ -/* - * pgr_trsp(sql text, eids integer[], pcts float8[], directed boolean, has_reverse_cost boolean, turn_restrict_sql text DEFAULT NULL::text) - * - * Compute TRSP with edge_ids and pposition along edge. We compute the path between eids[i], pcts[i] and eids[i+1], pcts[i+1] - * and chain the results together. - * - * NOTE: this is a prototype function, we can gain a lot of efficiencies by implementing this in C/C++ - * -*/ -declare - sql TEXT := $1; - eids INTEGER[] := $2; - pcts FLOAT[] := $3; - directed BOOLEAN := $4; - has_rcost BOOLEAN := $5; - - i integer; - rr RECORD; - lrr RECORD; - first boolean := true; - seq1 integer := 0; - seq2 integer :=0; - has_reverse BOOLEAN; - point_is_vertex BOOLEAN := false; - edges_sql TEXT; - f float; - -begin - RAISE WARNING 'pgr_trspViaEdges(text,integer[],float[],boolean,boolean,text) deprecated function on v3.4.0'; - SELECT 0::INTEGER AS seq, NULL::INTEGER AS id1, NULL::INTEGER AS id2, NULL::INTEGER AS id3, NULL::FLOAT AS cost INTO lrr; - has_reverse =_pgr_parameter_check('dijkstra', sql, false); - edges_sql := sql; - IF (has_reverse != has_rcost) THEN - IF (NOT has_rcost) THEN - -- user does not want to use reverse cost column - edges_sql = 'SELECT id, source, target, cost FROM (' || sql || ') a'; - ELSE - raise EXCEPTION 'has_rcost set to true but reverse_cost not found'; - END IF; - END IF; - - FOREACH f IN ARRAY pcts LOOP - IF f in (0,1) THEN - point_is_vertex := true; - END IF; - END LOOP; - - IF (turn_restrict_sql IS NULL OR length(turn_restrict_sql) = 0) AND NOT point_is_vertex THEN - -- no restrictions then its a _pgr_withPointsVia - RETURN query SELECT a.seq::INTEGER, path_id::INTEGER AS id1, node::INTEGER AS id2, edge::INTEGER AS id3, a.cost - FROM _pgr_withPointsVia(edges_sql, eids, pcts, directed) a; - RETURN; - END IF; - - if array_length(eids, 1) != array_length(pcts, 1) then - raise exception 'The length of arrays eids and pcts must be the same!'; - end if; - - -- loop through each pair of vids and compute the path - for i in 1 .. array_length(eids, 1)-1 loop - seq2 := seq2 + 1; - for rr in select a.seq, seq2 as id1, a.id1 as id2, a.id2 as id3, a.cost - from pgr_trsp(edges_sql, - eids[i], pcts[i], - eids[i+1], pcts[i+1], - directed, - has_rcost, - turn_restrict_sql) as a loop - -- combine intermediate via costs when cost is split across - -- two parts of a segment because it stops it and - -- restarts the next leg also on it - -- we might not want to do this so we can know where the via points are in the path result - -- but this needs more thought - -- - -- there are multiple condition we have to deal with - -- between the end of one leg and start of the next - -- 1. same vertex_id. edge_id=-1; drop record with edge_id=-1 - -- means: path ends on vertex - -- NOTICE: rr: (19,1,44570022,-1,0) - -- NOTICE: rr: (0,2,44570022,1768045,2.89691196717448) - -- 2. vertex_id=-1; sum cost components - -- means: path end/starts with the segment - -- NOTICE: rr: (11,2,44569628,1775909,9.32885885148532) - -- NOTICE: rr: (0,3,-1,1775909,0.771386350984395) - - --raise notice 'rr: %', rr; - if first then - lrr := rr; - first := false; - else - if lrr.id3 = -1 then - lrr := rr; - elsif lrr.id3 = rr.id3 then - lrr.cost := lrr.cost + rr.cost; - if rr.id2 = -1 then - rr.id2 := lrr.id2; - end if; - else - seq1 := seq1 + 1; - lrr.seq := seq1; - - seq := lrr.seq; - id1 := lrr.id1; - id2 := lrr.id2; - id3 := lrr.id3; - cost := lrr.cost; - return next; - lrr := rr; - end if; - end if; - end loop; - end loop; - - seq1 := seq1 + 1; - lrr.seq := seq1; - - seq := lrr.seq; - id1 := lrr.id1; - id2 := lrr.id2; - id3 := lrr.id3; - cost := lrr.cost; - return next; - return; -end; -$body$ -language plpgsql stable -cost 100 -rows 1000; - - --- COMMENTS - -COMMENT ON FUNCTION pgr_trspViaEdges(TEXT, INTEGER[], FLOAT[], BOOLEAN, BOOLEAN, TEXT) -IS 'pgr_trspViaEdges deprecated function on v3.4.0 -- Documentation: ${PROJECT_DOC_LINK}/pgr_trspVia_withPoints.html'; From c49033a0be9d82a7a7d7bb4fcd52d112fc508609 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Wed, 2 Oct 2024 18:20:56 -0600 Subject: [PATCH 7/8] [doc] Removing deprecated function pgr_trspViaEdges --- doc/src/migration.rst | 124 ++++++-------------------------------- doc/src/release_notes.rst | 5 +- 2 files changed, 23 insertions(+), 106 deletions(-) diff --git a/doc/src/migration.rst b/doc/src/migration.rst index 072e60275a2..4aef869e126 100644 --- a/doc/src/migration.rst +++ b/doc/src/migration.rst @@ -1291,107 +1291,41 @@ function been migrated then: * ``id2`` is the node * ``id3`` is the edge -Migration of ``pgr_trspViaEdges`` +Migration of pgr_trspViaEdges ------------------------------------------------------------------------------- -Signature to be migrated: - -.. parsed-literal:: - - pgr_trspViaEdges(sql text, eids integer[], pcts float8[], - directed boolean, has_rcost boolean - [, turn_restrict_sql text]); - RETURNS SETOF (seq, id1, id2, id3, cost) - - -* The integral types of the ``Edges SQL`` can only be ``INTEGER``. -* The floating point type of the ``Edges SQL`` can only be ``FLOAT``. -* ``directed`` flag is compulsory. - - * Does not have a default value. - -* Does not autodetect if ``reverse_cost`` column exist. - - * User must be careful to match the existence of the column with the value of - ``has_rcost`` parameter. - -* The restrictions inner query is optional. - -For these migration guide the following points will be used: - -.. literalinclude:: migration.queries - :start-after: --viav7 - :end-before: --edgesvia1 - -And will travel thru the following Via points :math:`4\rightarrow3\rightarrow6` - -Migrate by using: - -* :doc:`pgr_withPointsVia` when there are no restrictions, -* :doc:`pgr_trspVia_withPoints` when there are restrictions. +.. contents:: + :local: + :depth: 1 -Migrating ``pgr_trspViaEdges`` using ``pgr_withPointsVia`` -............................................................................... - -The following query does not have restrictions. +In this section this set of points is going to be used: .. literalinclude:: migration.queries :start-after: --edgesvia1 :end-before: --edgesvia2 -* A message about deprecation is shown - - * Deprecated functions will be removed on the next mayor version 4.0.0 +Migrating pgr_trspViaEdges using pgr_withPointsVia +............................................................................... -Use :doc:`pgr_withPointsVia` instead. +Using :doc:`pgr_withPointsVia`. .. literalinclude:: migration.queries :start-after: --edgesvia2 :end-before: --edgesvia3 -* The types casting has been removed. -* Do not show details, as the deprecated function does not show details. -* :doc:`pgr_withPointsVia`: - - * Autodetects if ``reverse_cost`` column is in the edges - SQL. - * Accepts ``ANY-INTEGER`` on integral types - * Accepts ``ANY-NUMERICAL`` on floating point types - * ``directed`` flag has a default value of ``true``. - - * Use the same value that on the original query. - * In this example it is ``true`` which is the default value. - - * The flag has been omitted and the default is been used. - * On the points query do not include the ``side`` column. - -When the need of using strictly the same (meaningless) names and types, and node -values of the function been migrated then: - -.. literalinclude:: migration.queries - :start-after: --edgesvia3 - :end-before: --edgesvia4 +When the need of using the same (meaningless) names and and strict types then +convert the result to the deprecated function columns: * ``id1`` is the path identifier * ``id2`` is the node * ``id3`` is the edge -Migrating ``pgr_trspViaEdges`` using ``pgr_trspVia_withPoints`` -............................................................................... - -The following query has restrictions. - .. literalinclude:: migration.queries - :start-after: --edgesvia4 - :end-before: --edgesvia5 - -* A message about deprecation is shown - - * Deprecated functions will be removed on the next mayor version 4.0.0 - -* The restrictions are the last parameter of the function + :start-after: --edgesvia3 + :end-before: --edgesvia4 - * Using the old structure of restrictions +Migrating pgr_trspViaEdges using pgr_trspVia_withPoints +............................................................................... Use :doc:`pgr_trspVia_withPoints` instead. @@ -1399,37 +1333,17 @@ Use :doc:`pgr_trspVia_withPoints` instead. :start-after: --edgesvia5 :end-before: --edgesvia6 -* The new structure of restrictions is been used. - - * It is the second parameter. +When the need of using the same (meaningless) names and and strict types then +convert the result to the deprecated function columns: -* The types casting has been removed. -* Do not show details, as the deprecated function does not show details. -* :doc:`pgr_trspVia_withPoints`: - - * Autodetects if ``reverse_cost`` column is in the edges - SQL. - * Accepts ``ANY-INTEGER`` on integral types - * Accepts ``ANY-NUMERICAL`` on floating point types - * ``directed`` flag has a default value of ``true``. - - * Use the same value that on the original query. - * In this example it is ``true`` which is the default value. - - * The flag has been omitted and the default is been used. - * On the points query do not include the ``side`` column. - -When the need of using strictly the same (meaningless) names and types, and node -values of the function been migrated then: +* ``id1`` is the path identifier +* ``id2`` is the node +* ``id3`` is the edge .. literalinclude:: migration.queries :start-after: --edgesvia6 :end-before: --edgesvia7 -* ``id1`` is the path identifier -* ``id2`` is the node -* ``id3`` is the edge - See Also ------------------------------------------------------------------------------- diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 54def867e57..01847a4c8db 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -39,7 +39,10 @@ pgRouting 4.0 pgRouting 4.0.0 Release Notes ------------------------------------------------------------------------------- -No Changes Yet +.. rubric:: Removal of deprecated functions and signatures + +* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)`` + pgRouting 3 From 92647d544e83e832e5716d888a1e09a8fe06d0e9 Mon Sep 17 00:00:00 2001 From: cvvergara Date: Tue, 22 Oct 2024 13:56:22 -0600 Subject: [PATCH 8/8] [NEWS.md] [doc] Removing deprecated function _pgr_trsp_withpoints --- NEWS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 61b037b9ba5..302deb34766 100644 --- a/NEWS.md +++ b/NEWS.md @@ -8,7 +8,10 @@ ### pgRouting 4.0.0 Release Notes -No Changes Yet +**Removal of deprecated functions and signatures** + +* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)`` + # pgRouting 3