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

Issue 2682 remove deprecated pgr_trspViaVertices #2688

Merged
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
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
**Removal of deprecated functions and signatures**

* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)``
* ``pgr_trspviavertices(text,anyarray,boolean,boolean,text)``



Expand Down
119 changes: 18 additions & 101 deletions doc/src/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1160,137 +1160,54 @@ values of the function been migrated then:
* ``id1`` is the node
* ``id2`` is the edge

Migration of ``pgr_trspViaVertices``
Migration of pgr_trspViaVertices
-------------------------------------------------------------------------------

Signature to be migrated:

.. parsed-literal::

pgr_trspViaVertices(sql text, vids integer[],
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.


Migrate by using:

* :doc:`pgr_dijkstraVia` when there are no restrictions,
* :doc:`pgr_trspVia` when there are restrictions.
.. contents::
:local:
:depth: 1

Migrating ``pgr_trspViaVertices`` using ``pgr_dijkstraVia``
Migrating pgr_trspViaVertices using pgr_dijkstraVia
...............................................................................

The following query does not have restrictions.

.. literalinclude:: migration.queries
:start-after: --viav1
:end-before: --viav2

* A message about deprecation is shown

* Deprecated functions will be removed on the next mayor version 4.0.0

Use :doc:`pgr_dijkstraVia` instead.
Using :doc:`pgr_dijkstraVia`.

.. literalinclude:: migration.queries
:start-after: --viav2
:end-before: --viav3

* The types casting has been removed.
* :doc:`pgr_dijkstraVia`:

* 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 of the
function been migrated then:

.. literalinclude:: migration.queries
:start-after: --viav3
:end-before: --viav4
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_trspViaVertices`` using ``pgr_trspVia``
...............................................................................

The following query has restrictions.

.. literalinclude:: migration.queries
:start-after: --viav4
:end-before: --viav5

* A message about deprecation is shown

* Deprecated functions will be removed on the next mayor version 4.0.0
:start-after: --viav3
:end-before: --viav4

* The restrictions are the last parameter of the function

* Using the old structure of restrictions
Migrating pgr_trspViaVertices using pgr_trspVia
...............................................................................

Use :doc:`pgr_trspVia` instead.
Using :doc:`pgr_trspVia`.

.. literalinclude:: migration.queries
:start-after: --viav5
:end-before: --viav6

* The new structure of restrictions is been used.

* It is the second parameter.

* The types casting has been removed.
* :doc:`pgr_trspVia`:

* 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 the same (meaningless) names and and strict types then
convert the result to the deprecated function columns:

When the need of using strictly the same (meaningless) names and types of the
function been migrated then:
* ``id1`` is the path identifier
* ``id2`` is the node
* ``id3`` is the edge

.. literalinclude:: migration.queries
:start-after: --viav6
:end-before: --viav7

* ``id1`` is the path identifier
* ``id2`` is the node
* ``id3`` is the edge

Migration of pgr_trspViaEdges
-------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions doc/src/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pgRouting 4.0.0 Release Notes
.. rubric:: Removal of deprecated functions and signatures

* ``pgr_trspviaedges(text,integer[],double precision[],boolean,boolean,text)``
* ``pgr_trspviavertices(text,anyarray,boolean,boolean,text)``



Expand Down
10 changes: 0 additions & 10 deletions docqueries/src/migration.pg
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ FROM pgr_trsp_withPoints(
details => false)
WHERE edge != -1;
/* --edgesv7 */
/* --viav1 */
SELECT * FROM pgr_trspViaVertices(
$$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$,
ARRAY[6, 3, 6],
true, true);
/* --viav2 */
SELECT * FROM pgr_dijkstraVia(
$$SELECT id, source, target, cost, reverse_cost FROM edges$$,
Expand All @@ -133,11 +128,6 @@ FROM pgr_dijkstraVia(
ARRAY[6, 3, 6])
WHERE edge != -1;
/* --viav4*/
SELECT * FROM pgr_trspViaVertices(
$$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$,
ARRAY[6, 3, 6],
true, true,
$$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$);
/* --viav5 */
SELECT * FROM pgr_trspVia(
$$SELECT id, source, target, cost, reverse_cost FROM edges$$,
Expand Down
36 changes: 0 additions & 36 deletions docqueries/src/migration.result
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,6 @@ WHERE edge != -1;
(10 rows)

/* --edgesv7 */
/* --viav1 */
SELECT * FROM pgr_trspViaVertices(
$$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$,
ARRAY[6, 3, 6],
true, true);
WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated function on v3.4.0
seq | id1 | id2 | id3 | cost
-----+-----+-----+-----+------
1 | 1 | 6 | 4 | 1
2 | 1 | 7 | 7 | 1
3 | 2 | 3 | 7 | 1
4 | 2 | 7 | 4 | 1
5 | 2 | 6 | -1 | 0
(5 rows)

/* --viav2 */
SELECT * FROM pgr_dijkstraVia(
$$SELECT id, source, target, cost, reverse_cost FROM edges$$,
Expand Down Expand Up @@ -327,27 +312,6 @@ WHERE edge != -1;
(5 rows)

/* --viav4*/
SELECT * FROM pgr_trspViaVertices(
$$SELECT id::INTEGER, source::INTEGER, target::INTEGER, cost, reverse_cost FROM edges$$,
ARRAY[6, 3, 6],
true, true,
$$SELECT to_cost, target_id::INTEGER, via_path FROM old_restrictions$$);
WARNING: pgr_trspViaVertices(text,anyarray,boolean,boolean,text) deprecated function on v3.4.0
seq | id1 | id2 | id3 | cost
-----+-----+-----+-----+------
1 | 1 | 6 | 4 | 1
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 | 2 | 3 | 7 | 1
10 | 2 | 7 | 4 | 1
11 | 2 | 6 | -1 | 0
(11 rows)

/* --viav5 */
SELECT * FROM pgr_trspVia(
$$SELECT id, source, target, cost, reverse_cost FROM edges$$,
Expand Down
65 changes: 0 additions & 65 deletions docqueries/trsp/issue717.pg

This file was deleted.

Loading
Loading