diff --git a/NEWS.md b/NEWS.md index 54453687d7d..a8007fd67a7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -47,20 +47,36 @@ milestone for 4.0.0 * pgr_dijkstra -**Removal of SQL deprecated functions and signatures** +**Removal of SQL deprecated functions** -* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text) -* pgr_trspviavertices(text,anyarray,boolean,boolean,text) * pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text) * pgr_trsp(text,integer,integer,boolean,boolean,text) +* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text) +* pgr_trspviavertices(text,anyarray,boolean,boolean,text) + +**Removal of SQL deprecated internal functions** + * _pgr_dijkstranear(text,anyarray,anyarray,bigint,boolean) * _pgr_dijkstranear(text,anyarray,bigint,bigint,boolean) * _pgr_dijkstranear(text,bigint,anyarray,bigint,boolean) * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint) +* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean) +* _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean) * _pgr_dijkstra(text,text,boolean,boolean,boolean) +* _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) +* _pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text) +* _pgr_trsp(text,text,anyarray,anyarray,boolean) +* _pgr_trsp(text,text,anyarray,bigint,boolean) +* _pgr_trsp(text,text,bigint,anyarray,boolean) +* _pgr_trsp(text,text,bigint,bigint,boolean) +* _pgr_trspviavertices(text,integer[],boolean,boolean,text) +* _trsp(text,text,anyarray,anyarray,boolean) +* _v4trsp(text,text,anyarray,anyarray,boolean) +* _v4trsp(text,text,text,boolean) **Deprecation of internal C/C++ functions** +* _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)`` * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)`` * _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean)`` diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 2004ac9814d..18066b76ca5 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -78,20 +78,36 @@ milestone for 4.0.0 * pgr_dijkstra -.. rubric:: Removal of SQL deprecated functions and signatures +.. rubric:: Removal of SQL deprecated functions -* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text) -* pgr_trspviavertices(text,anyarray,boolean,boolean,text) * pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text) * pgr_trsp(text,integer,integer,boolean,boolean,text) +* pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text) +* pgr_trspviavertices(text,anyarray,boolean,boolean,text) + +.. rubric:: Removal of SQL deprecated internal functions + * _pgr_dijkstranear(text,anyarray,anyarray,bigint,boolean) * _pgr_dijkstranear(text,anyarray,bigint,bigint,boolean) * _pgr_dijkstranear(text,bigint,anyarray,bigint,boolean) * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint) +* _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean) +* _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean) * _pgr_dijkstra(text,text,boolean,boolean,boolean) +* _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) +* _pgr_trsp(text,integer,double precision,integer,double precision,boolean,boolean,text) +* _pgr_trsp(text,text,anyarray,anyarray,boolean) +* _pgr_trsp(text,text,anyarray,bigint,boolean) +* _pgr_trsp(text,text,bigint,anyarray,boolean) +* _pgr_trsp(text,text,bigint,bigint,boolean) +* _pgr_trspviavertices(text,integer[],boolean,boolean,text) +* _trsp(text,text,anyarray,anyarray,boolean) +* _v4trsp(text,text,anyarray,anyarray,boolean) +* _v4trsp(text,text,text,boolean) .. rubric:: Deprecation of internal C/C++ functions +* _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint)`` * _pgr_dijkstra(text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)`` * _pgr_dijkstra(text,text,boolean,boolean,bigint,boolean)`` diff --git a/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg b/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg index 16f4d6c9b45..53660738b04 100644 --- a/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg +++ b/pgtap/dijkstra/driving_distance/edge_cases/issue_519.pg @@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); -SELECT plan(3); +SELECT CASE WHEN NOT min_version('3.6.0') AND min_lib_version('5.0.0') THEN plan(1) ELSE plan(3) END; CREATE OR REPLACE FUNCTION test_function() RETURNS SETOF TEXT AS $BODY$ @@ -41,6 +41,11 @@ BEGIN RETURN QUERY SELECT bag_has('q4', 'q2', '2: DD from [1, 5, 25] should have results of DD from 5'); RETURN QUERY SELECT bag_has('q4', 'q3', '3: DD from [1, 5, 25] should have results of DD from 25'); ELSE + IF min_lib_version('5.0.0') THEN + RETURN QUERY SELECT skip(1, 'Internal function deprecated on 3.6.0 and removed on 5.0.0'); + ELSE + --Internal function deprecated on 3.6.0 + SET client_min_messages TO WARNING; PREPARE q1 AS SELECT 1 AS from_v, node, edge, cost, agg_cost FROM pgr_drivingDistance('SELECT id, source, target, cost FROM edges', 1, 3.5); @@ -56,6 +61,8 @@ BEGIN RETURN QUERY SELECT bag_has('q4', 'q1', '1: DD from [1, 5, 25] should have results of DD from 1'); RETURN QUERY SELECT bag_has('q4', 'q2', '2: DD from [1, 5, 25] should have results of DD from 5'); RETURN QUERY SELECT bag_has('q4', 'q3', '3: DD from [1, 5, 25] should have results of DD from 25'); + SET client_min_messages TO NOTICE; + END IF; END IF; END; $BODY$ diff --git a/pgtap/dijkstra/driving_distance/inner_query.pg b/pgtap/dijkstra/driving_distance/inner_query.pg index 58b147ac008..957df4eb144 100644 --- a/pgtap/dijkstra/driving_distance/inner_query.pg +++ b/pgtap/dijkstra/driving_distance/inner_query.pg @@ -20,16 +20,23 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); -SELECT plan(108); +SELECT CASE WHEN NOT min_version('3.6.0') AND min_lib_version('5.0.0') THEN plan(1) ELSE plan(108) END; --- ONE SOURCE -SELECT style_dijkstra('pgr_drivingdistance(', ',2, 1, true)'); - --- MANY SOURCES -SELECT style_dijkstra('pgr_drivingdistance(', ',ARRAY[2,3], 1, true)'); - +CREATE OR REPLACE FUNCTION inner_query() RETURNS SETOF TEXT AS +$BODY$ +BEGIN + IF NOT min_version('3.6.0') AND min_lib_version('5.0.0') THEN + RETURN NEXT skip(1, 'Internal function deprecated on 3.6.0 and removed on 5.0.0'); + RETURN; + END IF; + RETURN QUERY SELECT style_dijkstra('pgr_drivingdistance(', ',2, 1, true)'); + RETURN QUERY SELECT style_dijkstra('pgr_drivingdistance(', ',ARRAY[2,3], 1, true)'); +END; +$BODY$ +LANGUAGE plpgsql; +SELECT inner_query(); SELECT finish(); ROLLBACK; diff --git a/pgtap/dijkstra/driving_distance/no_crash_test.pg b/pgtap/dijkstra/driving_distance/no_crash_test.pg index ea2324d34d4..890633d90e5 100644 --- a/pgtap/dijkstra/driving_distance/no_crash_test.pg +++ b/pgtap/dijkstra/driving_distance/no_crash_test.pg @@ -20,7 +20,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. BEGIN; UPDATE edges SET cost = sign(cost), reverse_cost = sign(reverse_cost); -SELECT plan(34); +SELECT CASE WHEN NOT min_version('3.6.0') AND min_lib_version('5.0.0') THEN plan(1) ELSE plan(34) END; PREPARE edges AS SELECT id, source, target, cost, reverse_cost FROM edges; @@ -39,6 +39,11 @@ DECLARE params TEXT[]; subs TEXT[]; BEGIN + IF NOT min_version('3.6.0') AND min_lib_version('5.0.0') THEN + RETURN NEXT skip(1, 'Internal function deprecated on 3.6.0 and removed on 5.0.0'); + RETURN; + END IF; + -- 1 to distance params = ARRAY['$$SELECT id, source, target, cost, reverse_cost FROM edges$$','1', '1.3::FLOAT']::TEXT[]; subs = ARRAY[ diff --git a/pgtap/dijkstra/driving_distance/types_check.pg b/pgtap/dijkstra/driving_distance/types_check.pg index 0068a8629f2..e3dc5e85c74 100644 --- a/pgtap/dijkstra/driving_distance/types_check.pg +++ b/pgtap/dijkstra/driving_distance/types_check.pg @@ -29,49 +29,38 @@ SELECT has_function('pgr_drivingdistance', ARRAY['text','anyarray','double preci SELECT function_returns('pgr_drivingdistance', ARRAY['text','bigint','double precision','boolean'],'setof record'); SELECT function_returns('pgr_drivingdistance', ARRAY['text','anyarray','double precision','boolean','boolean'],'setof record'); -CREATE OR REPLACE FUNCTION types_check() -RETURNS SETOF TEXT AS -$BODY$ -BEGIN +SELECT CASE +WHEN (min_version('3.6.0')) THEN + collect_tap( + set_eq( + $$SELECT proargnames from pg_proc where proname = 'pgr_drivingdistance'$$, + $$VALUES + ('{"","","","directed","seq","depth","start_vid","pred","node","edge","cost","agg_cost"}'::TEXT[]), + ('{"","","","directed","equicost","seq","depth","start_vid","pred","node","edge","cost","agg_cost"}'::TEXT[]) + $$), -IF (min_version('3.6.0')) THEN -RETURN QUERY -SELECT set_eq( - $$SELECT proargnames from pg_proc where proname = 'pgr_drivingdistance'$$, - $$VALUES - ('{"","","","directed","seq","depth","start_vid","pred","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","equicost","seq","depth","start_vid","pred","node","edge","cost","agg_cost"}'::TEXT[]) - $$); + set_eq( + $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, + $$VALUES + ('{25,20,701,16,20,20,20,20,20,20,701,701}'::OID[]), + ('{25,2277,701,16,16,20,20,20,20,20,20,701,701}'::OID[]) + $$)) + ELSE + collect_tap( + set_eq( + $$SELECT proargnames from pg_proc where proname = 'pgr_drivingdistance'$$, + $$VALUES + ('{"","","","directed","seq","node","edge","cost","agg_cost"}'::TEXT[]), + ('{"","","","directed","equicost","seq","from_v","node","edge","cost","agg_cost"}'::TEXT[]) + $$), -RETURN QUERY -SELECT set_eq( - $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, - $$VALUES - ('{25,20,701,16,20,20,20,20,20,20,701,701}'::OID[]), - ('{25,2277,701,16,16,20,20,20,20,20,20,701,701}'::OID[]) - $$); -ELSE --- old signatures -RETURN QUERY -SELECT set_eq( - $$SELECT proargnames from pg_proc where proname = 'pgr_drivingdistance'$$, - $$VALUES - ('{"","","","directed","seq","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","equicost","seq","from_v","node","edge","cost","agg_cost"}'::TEXT[]) - $$); - -RETURN QUERY -SELECT set_eq( - $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, - $$VALUES - ('{25,20,701,16,23,20,20,701,701}'::OID[]), - ('{25,2277,701,16,16,23,20,20,20,701,701}'::OID[]) - $$); -END IF; + set_eq( + $$SELECT proallargtypes from pg_proc where proname = 'pgr_drivingdistance'$$, + $$VALUES + ('{25,20,701,16,23,20,20,701,701}'::OID[]), + ('{25,2277,701,16,16,23,20,20,20,701,701}'::OID[]) + $$)) END; -$BODY$ -LANGUAGE plpgsql; -SELECT * FROM types_check(); SELECT finish(); ROLLBACK; diff --git a/sql/driving_distance/_drivingDistance.sql b/sql/driving_distance/_drivingDistance.sql index 55513c77736..1674f748aef 100644 --- a/sql/driving_distance/_drivingDistance.sql +++ b/sql/driving_distance/_drivingDistance.sql @@ -25,10 +25,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ----------------------- --- pgr_drivingDistance ----------------------- - --v3.6 CREATE FUNCTION _pgr_drivingDistancev4( TEXT, -- edges_sql @@ -48,31 +44,5 @@ RETURNS SETOF RECORD AS 'MODULE_PATHNAME' LANGUAGE c VOLATILE STRICT; --- COMMENTS - COMMENT ON FUNCTION _pgr_drivingDistancev4(TEXT, ANYARRAY, FLOAT, BOOLEAN, BOOLEAN) IS 'pgRouting internal function'; - -/* Below functions are for backward compatibility to be removed on v4*/ - ---v3.0 -CREATE FUNCTION _pgr_drivingDistance( - edges_sql TEXT, - start_vids ANYARRAY, - distance FLOAT, - directed BOOLEAN DEFAULT TRUE, - equicost BOOLEAN DEFAULT FALSE, - OUT seq INTEGER, - OUT from_v BIGINT, - OUT node BIGINT, - OUT edge BIGINT, - OUT cost FLOAT, - OUT agg_cost FLOAT) -RETURNS SETOF RECORD AS -'MODULE_PATHNAME' -LANGUAGE c VOLATILE STRICT; - --- COMMENTS - -COMMENT ON FUNCTION _pgr_drivingDistance(TEXT, ANYARRAY, FLOAT, BOOLEAN, BOOLEAN) -IS 'pgRouting internal function deprecated on v3.6.0'; diff --git a/sql/sigs/pgrouting--4.0.sig b/sql/sigs/pgrouting--4.0.sig index 5c8022230a7..4914f4a43e4 100644 --- a/sql/sigs/pgrouting--4.0.sig +++ b/sql/sigs/pgrouting--4.0.sig @@ -127,7 +127,6 @@ pgr_dijkstra(text,text,boolean) _pgr_dijkstrav4(text,text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean) _pgr_dijkstravia(text,anyarray,boolean,boolean,boolean) pgr_dijkstravia(text,anyarray,boolean,boolean,boolean) -_pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) pgr_drivingdistance(text,anyarray,double precision,boolean,boolean) pgr_drivingdistance(text,bigint,double precision,boolean) _pgr_drivingdistancev4(text,anyarray,double precision,boolean,boolean) diff --git a/src/driving_distance/driving_distance.c b/src/driving_distance/driving_distance.c index d687beb3dad..6a03b892465 100644 --- a/src/driving_distance/driving_distance.c +++ b/src/driving_distance/driving_distance.c @@ -37,10 +37,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "drivers/driving_distance/driving_distance_driver.h" - -PGDLLEXPORT Datum _pgr_drivingdistance(PG_FUNCTION_ARGS); -PG_FUNCTION_INFO_V1(_pgr_drivingdistance); - PGDLLEXPORT Datum _pgr_drivingdistancev4(PG_FUNCTION_ARGS); PG_FUNCTION_INFO_V1(_pgr_drivingdistancev4); @@ -164,10 +160,15 @@ _pgr_drivingdistancev4(PG_FUNCTION_ARGS) { } -/* Old code starts here - * TODO(v4) remove old code - * its code that is used when there is an old version of SQL 3.5 and under +/* Deprecated code starts here + * This code is used on v3.5 and under + * + * TODO(v5) Move to legacy */ + +PGDLLEXPORT Datum _pgr_drivingdistance(PG_FUNCTION_ARGS); +PG_FUNCTION_INFO_V1(_pgr_drivingdistance); + PGDLLEXPORT Datum _pgr_drivingdistance(PG_FUNCTION_ARGS) { FuncCallContext *funcctx; @@ -176,6 +177,12 @@ _pgr_drivingdistance(PG_FUNCTION_ARGS) { MST_rt *result_tuples = 0; size_t result_count = 0; + ereport(NOTICE, ( + errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("A stored procedure is using deprecated C internal function '%s'", __func__), + errdetail("Library function '%s' was deprecated in pgRouting %s", __func__, "3.6.0"), + errhint("Consider upgrade pgRouting"))); + if (SRF_IS_FIRSTCALL()) { MemoryContext oldcontext;