Skip to content

Commit

Permalink
(_pgr_drivingDistance) Removing deprecated internal function
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Jan 25, 2025
1 parent 0242240 commit 09663cd
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 122 deletions.
23 changes: 19 additions & 4 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,30 @@ 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,double
* pgr_trsp(text,integer,integer,boolean,boolean,text)
* pgr_trspviaedges(text,integer[],double
* 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_dijkstrav4(text,text,anyarray,anyarray,boolean,boolean,boolean,bigint,boolean)
* _pgr_drivingdistance(text,anyarray,double
* _pgr_trsp(text,integer,double
* _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

Expand All @@ -99,10 +112,12 @@ milestone for 4.0.0

.. rubric:: Internal C/C++ functions in legacy

* _pgr_drivingdistance(text,anyarray,double precision,boolean,boolean)
* _trsp(text,text,anyarray,anyarray,boolean)``
* _v4trsp(text,text,anyarray,anyarray,boolean)``
* _v4trsp(text,text,text,boolean)``


pgRouting 3
*******************************************************************************

Expand Down
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';
1 change: 0 additions & 1 deletion sql/sigs/pgrouting--4.0.sig
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
87 changes: 0 additions & 87 deletions src/driving_distance/driving_distance.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -162,86 +158,3 @@ _pgr_drivingdistancev4(PG_FUNCTION_ARGS) {
SRF_RETURN_DONE(funcctx);
}
}


/* 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
*/
PGDLLEXPORT Datum
_pgr_drivingdistance(PG_FUNCTION_ARGS) {
FuncCallContext *funcctx;
TupleDesc tuple_desc;

MST_rt *result_tuples = 0;
size_t result_count = 0;

if (SRF_IS_FIRSTCALL()) {
MemoryContext oldcontext;

funcctx = SRF_FIRSTCALL_INIT();
oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);


PGR_DBG("Calling driving_many_to_dist_driver");
process(
text_to_cstring(PG_GETARG_TEXT_P(0)),
PG_GETARG_ARRAYTYPE_P(1),
PG_GETARG_FLOAT8(2),
PG_GETARG_BOOL(3),
PG_GETARG_BOOL(4),
&result_tuples, &result_count);


funcctx->max_calls = result_count;

funcctx->user_fctx = result_tuples;
if (get_call_result_type(fcinfo, NULL, &tuple_desc)
!= TYPEFUNC_COMPOSITE)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("function returning record called in context "
"that cannot accept type record")));

funcctx->tuple_desc = tuple_desc;

MemoryContextSwitchTo(oldcontext);
}

funcctx = SRF_PERCALL_SETUP();

tuple_desc = funcctx->tuple_desc;
result_tuples = (MST_rt*) funcctx->user_fctx;

if (funcctx->call_cntr < funcctx->max_calls) {
HeapTuple tuple;
Datum result;
Datum *values;
bool* nulls;

size_t numb = 6;
values = palloc(numb * sizeof(Datum));
nulls = palloc(numb * sizeof(bool));

size_t i;
for (i = 0; i < numb; ++i) {
nulls[i] = false;
}
values[0] = Int32GetDatum((int32_t)funcctx->call_cntr + 1);
values[1] = Int64GetDatum(result_tuples[funcctx->call_cntr].from_v);
values[2] = Int64GetDatum(result_tuples[funcctx->call_cntr].node);
values[3] = Int64GetDatum(result_tuples[funcctx->call_cntr].edge);
values[4] = Float8GetDatum(result_tuples[funcctx->call_cntr].cost);
values[5] = Float8GetDatum(result_tuples[funcctx->call_cntr].agg_cost);

tuple = heap_form_tuple(tuple_desc, values, nulls);
result = HeapTupleGetDatum(tuple);

pfree(values);
pfree(nulls);

SRF_RETURN_NEXT(funcctx, result);
} else {
SRF_RETURN_DONE(funcctx);
}
}
1 change: 1 addition & 0 deletions src/legacy/legacy.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PGROUTING_DEPRECATE("4.0.0", _pgr_trsp)
PGROUTING_DEPRECATE("4.0.0", _v4trsp)
PGROUTING_DEPRECATE("4.0.0", _trsp)
PGROUTING_DEPRECATE("4.0.0", _pgr_drivingdistance)

0 comments on commit 09663cd

Please sign in to comment.