Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated functions #2732

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,32 @@ milestone for 4.0.0

* pgr_dijkstra

**Removal of SQL deprecated functions and signatures**
**Removal of SQL deprecated functions**

* pgr_trsp(text,integer,double
* pgr_trsp(text,integer,integer,boolean,boolean,text)
* 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)

**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_dijkstrav4(text,text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)
* _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)

**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)``
Expand Down
18 changes: 15 additions & 3 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,32 @@ milestone for 4.0.0

* pgr_dijkstra

.. rubric:: Removal of SQL deprecated functions and signatures
.. rubric:: Removal of SQL deprecated functions

* pgr_trsp(text,integer,double
* pgr_trsp(text,integer,integer,boolean,boolean,text)
* 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)

.. 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_dijkstrav4(text,text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)
* _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)

.. 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)``
Expand Down
9 changes: 8 additions & 1 deletion pgtap/dijkstra/driving_distance/edge_cases/issue_519.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.
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$
Expand All @@ -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);

Expand All @@ -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$
Expand Down
21 changes: 14 additions & 7 deletions pgtap/dijkstra/driving_distance/inner_query.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines +26 to +38
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Consider refactoring the conditional logic for clarity.
The nested usage of NOT min_version('3.6.0') AND min_lib_version('5.0.0') can be a bit confusing. You might consider inverting or rewording the condition (e.g., ELSIF structure) for better readability.


SELECT inner_query();
SELECT finish();
ROLLBACK;
7 changes: 6 additions & 1 deletion pgtap/dijkstra/driving_distance/no_crash_test.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Comment on lines +42 to +45
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Use an ELSIF block for more direct readability.
The condition to skip tests if the function is deprecated is correct, but inverting or restructuring the condition could make the code flow clearer.


-- 1 to distance
params = ARRAY['$$SELECT id, source, target, cost, reverse_cost FROM edges$$','1', '1.3::FLOAT']::TEXT[];
subs = ARRAY[
Expand Down
69 changes: 29 additions & 40 deletions pgtap/dijkstra/driving_distance/types_check.pg
Original file line number Diff line number Diff line change
Expand Up @@ -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[])
$$))
Comment on lines +32 to +62
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Unify version checks with other files for consistency.
Here, the condition uses min_version('3.6.0') directly, while other files use a more complex compound check. Adopting a similar pattern throughout might enhance maintainability and readability.

END;
$BODY$
LANGUAGE plpgsql;

SELECT * FROM types_check();
SELECT finish();
ROLLBACK;
30 changes: 0 additions & 30 deletions sql/driving_distance/_drivingDistance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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';
74 changes: 0 additions & 74 deletions sql/legacy/alpha_shape.sql

This file was deleted.

Loading
Loading