diff --git a/NEWS.md b/NEWS.md index 60cfde279ab..5a2d28dd93e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -68,9 +68,13 @@ Functions promoted to official * pgr_maxFlow(Combinations) * pgr_pushRelabel(Combinations) -SQL signatures modification on functions +SQL signatures and output standardization ............................................................................... +[#2904](https://github.com/pgRouting/pgrouting/issues/2904) +Standardize output columns of functions with different output columns within overloads + + **Official functions** * [#2906](https://github.com/pgRouting/pgrouting/issues/2906) pgr_bdDijkstra @@ -78,8 +82,33 @@ SQL signatures modification on functions * Output columns standardized to ``(seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)`` * Combinations signature promoted to official. +* [#2905](https://github.com/pgRouting/pgrouting/issues/2905) + pgr_withPoints + + * Output columns standardized to ``(seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)`` + * Function promoted to official. + * Signature change: ``driving_side`` parameter changed from named optional to + unnamed positional. + - Directed graph valid values: ``l`` or ``L`` and ``r``, ``R`` + - Undirected graph valid values: ``b`` or ``B`` + +* [#2905](https://github.com/pgRouting/pgrouting/issues/2905) + pgr_withPointsCost + + * Function promoted to official. + * Output columns standardized to ``(start_vid, end_vid, agg_cost)`` + * Signature change: ``driving_side`` parameter changed from named optional to + unnamed positional. + - Directed graph valid values: ``l`` or ``L`` and ``r``, ``R`` + - Undirected graph valid values: ``b`` or ``B`` + **Experimental functions** +* [#2907](https://github.com/pgRouting/pgrouting/issues/2907) + pgr_bellmanFord + + * Output columns standardized to ``(seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)`` + * [#2910](https://github.com/pgRouting/pgrouting/issues/2910) pgr_edwardMoore diff --git a/doc/bellman_ford/pgr_bellmanFord.rst b/doc/bellman_ford/pgr_bellmanFord.rst index 348faa9e169..ad2ad760b66 100644 --- a/doc/bellman_ford/pgr_bellmanFord.rst +++ b/doc/bellman_ford/pgr_bellmanFord.rst @@ -24,6 +24,10 @@ .. rubric:: Availability: +.. rubric:: Version 4.0.0 + +* Output columns standardized to |short-generic-result| + .. rubric:: Version 3.2.0 * New experimental signature: @@ -87,7 +91,7 @@ Signatures | pgr_bellmanFord(`Edges SQL`_, **start vids**, **end vids**, [``directed``]) | pgr_bellmanFord(`Edges SQL`_, `Combinations SQL`_, [``directed``]) - | Returns set of |old-generic-result| + | Returns set of |short-generic-result| | OR EMPTY SET .. index:: @@ -101,7 +105,7 @@ One to One | pgr_bellmanFord(`Edges SQL`_, **start vid**, **end vid**, [``directed``]) - | Returns set of |result-1-1| + | Returns set of |short-generic-result| | OR EMPTY SET :Example: From vertex :math:`6` to vertex :math:`10` on a **directed** graph @@ -121,7 +125,7 @@ One to Many | pgr_bellmanFord(`Edges SQL`_, **start vid**, **end vids**, [``directed``]) - | Returns set of |result-1-m| + | Returns set of |short-generic-result| | OR EMPTY SET :Example: From vertex :math:`6` to vertices :math:`\{10, 17\}` on a **directed** @@ -142,7 +146,7 @@ Many to One | pgr_bellmanFord(`Edges SQL`_, **start vids**, **end vid**, [``directed``]) - | Returns set of |result-m-1| + | Returns set of |short-generic-result| | OR EMPTY SET :Example: From vertices :math:`\{6, 1\}` to vertex :math:`17` on a **directed** @@ -187,7 +191,7 @@ Combinations | Returns set of |short-generic-result| | OR EMPTY SET -:Example: Using a combinations table on an **undirected** graph. +:Example: Using a combinations table on an **undirected** graph The combinations table: @@ -236,8 +240,8 @@ Result columns ------------------------------------------------------------------------------- .. include:: pgRouting-concepts.rst - :start-after: return_path_short_start - :end-before: return_path_short_end + :start-after: return_path_complete_start + :end-before: return_path_complete_end Additional Examples ------------------------------------------------------------------------------- diff --git a/doc/src/migration.rst b/doc/src/migration.rst index ee4092fc97d..c1ba077b391 100644 --- a/doc/src/migration.rst +++ b/doc/src/migration.rst @@ -79,7 +79,9 @@ types. - `Migration of spanning tree functions`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_bdDijkstra` [1]_ - `Migration of single path functions`_ - * - .. versionchanged:: 4.0.0 ``pgr_edwardMoore`` [3]_ + * - .. versionchanged:: 4.0.0 :doc:`pgr_bellmanFord` [3]_ + - `Migration of single path functions`_ + * - .. versionchanged:: 4.0.0 :doc:`pgr_edwardMoore` [3]_ - `Migration of single path functions`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_withPoints` [2]_ - `Migration of single path functions`_ @@ -88,13 +90,6 @@ types. * - .. versionchanged:: 4.0.0 :doc:`pgr_withPointsCostMatrix` [2]_ - `Migration of cost functions`_ - -.. - * - .. versionchanged:: 4.0.0 :doc:`pgr_bellmanFord` - - `Migration of single path functions`_ - * - .. versionchanged:: 4.0.0 :doc:`pgr_binaryBreadthFirstSearch` - - `Migration of single path functions`_ - .. [1] Official function before v4.0.0 .. [2] Official function in v4.0.0 .. [3] Experimental or proposed in v4.0.0 @@ -306,29 +301,24 @@ application. * - Function - Version - From - * - ``pgr_aStar`` - - v < 3.6 - - |old-generic-result| * - ``pgr_dijkstra`` - v < 3.5 - |old-generic-result| - * - ``pgr_bdDijkstra`` - - v < 4.0 + * - ``pgr_aStar`` + - v < 3.6 - |old-generic-result| - * - ``pgr_withPoints`` - - v < 4.0 - - |old-pid-result| - * - ``pgr_edwardMoore`` + * - ``pgr_bdDijkstra`` - v < 4.0 - |old-generic-result| - -.. * - ``pgr_bellmanFord`` - v < 4.0 - |old-generic-result| - * - ``pgr_BinaryBreadthFirstSearch`` + * - ``pgr_edwardMoore`` - v < 4.0 - |old-generic-result| + * - ``pgr_withPoints`` + - v < 4.0 + - |old-pid-result| :to: |short-generic-result| diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index bf2fcf061c2..0900f1d4524 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -89,9 +89,13 @@ Functions promoted to official * pgr_maxFlow(Combinations) * pgr_pushRelabel(Combinations) -SQL signatures modification on functions +SQL signatures and output standardization ............................................................................... +`#2904 `__ +Standardize output columns of functions with different output columns within overloads + + .. rubric:: Official functions * `#2906 `__ pgr_bdDijkstra @@ -100,8 +104,29 @@ SQL signatures modification on functions :start-after: Version 4.0.0 :end-before: .. rubric +* `#2905 `__ + pgr_withPoints + + .. include:: pgr_withPoints.rst + :start-after: Version 4.0.0 + :end-before: .. rubric + +* `#2905 `__ + pgr_withPointsCost + + .. include:: pgr_withPointsCost.rst + :start-after: Version 4.0.0 + :end-before: .. rubric + .. rubric:: Experimental functions +* `#2907 `__ + pgr_bellmanFord + + .. include:: pgr_bellmanFord.rst + :start-after: Version 4.0.0 + :end-before: .. rubric + * `#2910 `__ pgr_edwardMoore diff --git a/docqueries/bellman_ford/bellmanFord.result b/docqueries/bellman_ford/bellmanFord.result index 36d1a3495f6..5bbed5a0181 100644 --- a/docqueries/bellman_ford/bellmanFord.result +++ b/docqueries/bellman_ford/bellmanFord.result @@ -6,52 +6,52 @@ SET SELECT * FROM pgr_bellmanFord( 'SELECT id, source, target, cost, reverse_cost FROM edges', 6, 10, true); - seq | path_seq | node | edge | cost | agg_cost ------+----------+------+------+------+---------- - 1 | 1 | 6 | 4 | 1 | 0 - 2 | 2 | 7 | 8 | 1 | 1 - 3 | 3 | 11 | 9 | 1 | 2 - 4 | 4 | 16 | 16 | 1 | 3 - 5 | 5 | 15 | 3 | 1 | 4 - 6 | 6 | 10 | -1 | 0 | 5 + seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost +-----+----------+-----------+---------+------+------+------+---------- + 1 | 1 | 6 | 10 | 6 | 4 | 1 | 0 + 2 | 2 | 6 | 10 | 7 | 8 | 1 | 1 + 3 | 3 | 6 | 10 | 11 | 9 | 1 | 2 + 4 | 4 | 6 | 10 | 16 | 16 | 1 | 3 + 5 | 5 | 6 | 10 | 15 | 3 | 1 | 4 + 6 | 6 | 6 | 10 | 10 | -1 | 0 | 5 (6 rows) /* -- q3 */ SELECT * FROM pgr_bellmanFord( 'SELECT id, source, target, cost, reverse_cost FROM edges', 6, ARRAY[10, 17]); - seq | path_seq | end_vid | node | edge | cost | agg_cost ------+----------+---------+------+------+------+---------- - 1 | 1 | 10 | 6 | 4 | 1 | 0 - 2 | 2 | 10 | 7 | 8 | 1 | 1 - 3 | 3 | 10 | 11 | 9 | 1 | 2 - 4 | 4 | 10 | 16 | 16 | 1 | 3 - 5 | 5 | 10 | 15 | 3 | 1 | 4 - 6 | 6 | 10 | 10 | -1 | 0 | 5 - 7 | 1 | 17 | 6 | 4 | 1 | 0 - 8 | 2 | 17 | 7 | 8 | 1 | 1 - 9 | 3 | 17 | 11 | 11 | 1 | 2 - 10 | 4 | 17 | 12 | 13 | 1 | 3 - 11 | 5 | 17 | 17 | -1 | 0 | 4 + seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost +-----+----------+-----------+---------+------+------+------+---------- + 1 | 1 | 6 | 10 | 6 | 4 | 1 | 0 + 2 | 2 | 6 | 10 | 7 | 8 | 1 | 1 + 3 | 3 | 6 | 10 | 11 | 9 | 1 | 2 + 4 | 4 | 6 | 10 | 16 | 16 | 1 | 3 + 5 | 5 | 6 | 10 | 15 | 3 | 1 | 4 + 6 | 6 | 6 | 10 | 10 | -1 | 0 | 5 + 7 | 1 | 6 | 17 | 6 | 4 | 1 | 0 + 8 | 2 | 6 | 17 | 7 | 8 | 1 | 1 + 9 | 3 | 6 | 17 | 11 | 11 | 1 | 2 + 10 | 4 | 6 | 17 | 12 | 13 | 1 | 3 + 11 | 5 | 6 | 17 | 17 | -1 | 0 | 4 (11 rows) /* -- q4 */ SELECT * FROM pgr_bellmanFord( 'SELECT id, source, target, cost, reverse_cost FROM edges', ARRAY[6, 1], 17); - seq | path_seq | start_vid | node | edge | cost | agg_cost ------+----------+-----------+------+------+------+---------- - 1 | 1 | 1 | 1 | 6 | 1 | 0 - 2 | 2 | 1 | 3 | 7 | 1 | 1 - 3 | 3 | 1 | 7 | 8 | 1 | 2 - 4 | 4 | 1 | 11 | 11 | 1 | 3 - 5 | 5 | 1 | 12 | 13 | 1 | 4 - 6 | 6 | 1 | 17 | -1 | 0 | 5 - 7 | 1 | 6 | 6 | 4 | 1 | 0 - 8 | 2 | 6 | 7 | 8 | 1 | 1 - 9 | 3 | 6 | 11 | 11 | 1 | 2 - 10 | 4 | 6 | 12 | 13 | 1 | 3 - 11 | 5 | 6 | 17 | -1 | 0 | 4 + seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost +-----+----------+-----------+---------+------+------+------+---------- + 1 | 1 | 1 | 17 | 1 | 6 | 1 | 0 + 2 | 2 | 1 | 17 | 3 | 7 | 1 | 1 + 3 | 3 | 1 | 17 | 7 | 8 | 1 | 2 + 4 | 4 | 1 | 17 | 11 | 11 | 1 | 3 + 5 | 5 | 1 | 17 | 12 | 13 | 1 | 4 + 6 | 6 | 1 | 17 | 17 | -1 | 0 | 5 + 7 | 1 | 6 | 17 | 6 | 4 | 1 | 0 + 8 | 2 | 6 | 17 | 7 | 8 | 1 | 1 + 9 | 3 | 6 | 17 | 11 | 11 | 1 | 2 + 10 | 4 | 6 | 17 | 12 | 13 | 1 | 3 + 11 | 5 | 6 | 17 | 17 | -1 | 0 | 4 (11 rows) /* -- q5 */ diff --git a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po index 80f409c8884..01df7de5da2 100644 --- a/locale/en/LC_MESSAGES/pgrouting_doc_strings.po +++ b/locale/en/LC_MESSAGES/pgrouting_doc_strings.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pgRouting v3.8\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-11 19:19+0000\n" +"POT-Creation-Date: 2025-06-12 15:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -4007,7 +4007,13 @@ msgstr "" msgid "pgr_pushRelabel(Combinations)" msgstr "" -msgid "SQL signatures modification on functions" +msgid "SQL signatures and output standardization" +msgstr "" + +msgid "" +"`#2904 `__ " +"Standardize output columns of functions with different output columns " +"within overloads" msgstr "" msgid "Official functions" @@ -4021,6 +4027,17 @@ msgstr "" msgid "Combinations signature promoted to official." msgstr "" +msgid "`#2905 `__" +msgstr "" + +msgid "pgr_withPoints" +msgstr "" + +msgid "" +"`#2907 `__ " +"pgr_bellmanFord" +msgstr "" + msgid "" "`#2910 `__ " "pgr_edwardMoore" @@ -4444,7 +4461,10 @@ msgstr "" msgid ":doc:`pgr_bdDijkstra` [1]_" msgstr "" -msgid "``pgr_edwardMoore`` [3]_" +msgid ":doc:`pgr_bellmanFord` [3]_" +msgstr "" + +msgid ":doc:`pgr_edwardMoore` [3]_" msgstr "" msgid ":doc:`pgr_withPoints` [2]_" @@ -4604,31 +4624,34 @@ msgid "" "functions` are |short-generic-result|" msgstr "" -msgid "``pgr_aStar``" +msgid "``pgr_dijkstra``" msgstr "" -msgid "v < 3.6" +msgid "v < 3.5" msgstr "" msgid "|old-generic-result|" msgstr "" -msgid "``pgr_dijkstra``" +msgid "``pgr_aStar``" msgstr "" -msgid "v < 3.5" +msgid "v < 3.6" msgstr "" msgid "``pgr_bdDijkstra``" msgstr "" -msgid "``pgr_withPoints``" +msgid "``pgr_bellmanFord``" msgstr "" -msgid "|old-pid-result|" +msgid "``pgr_edwardMoore``" msgstr "" -msgid "``pgr_edwardMoore``" +msgid "``pgr_withPoints``" +msgstr "" + +msgid "|old-pid-result|" msgstr "" msgid "Migration of |old-generic-result|" @@ -8707,18 +8730,6 @@ msgstr "" msgid "pgr_bellmanFord(`Edges SQL`_, `Combinations SQL`_, [``directed``])" msgstr "" -msgid "Returns set of |result-1-1|" -msgstr "" - -msgid "Returns set of |result-1-m|" -msgstr "" - -msgid "Returns set of |result-m-1|" -msgstr "" - -msgid "Using a combinations table on an **undirected** graph." -msgstr "" - msgid "" "`Boost: Bellman Ford " "`__" @@ -8949,6 +8960,15 @@ msgid "" "(i.e :math:`1``)" msgstr "" +msgid "Returns set of |result-1-1|" +msgstr "" + +msgid "Returns set of |result-1-m|" +msgstr "" + +msgid "Returns set of |result-m-1|" +msgstr "" + msgid "" "`Boost: Breadth First Search " "`__" @@ -11825,6 +11845,9 @@ msgstr "" msgid "pgr_edwardMoore(`Edges SQL`_, `Combinations SQL`_, [``directed``])" msgstr "" +msgid "Using a combinations table on an **undirected** graph." +msgstr "" + msgid "https://en.wikipedia.org/wiki/Shortest_Path_Faster_Algorithm" msgstr "" diff --git a/locale/pot/pgrouting_doc_strings.pot b/locale/pot/pgrouting_doc_strings.pot index 351ae6c03ee..06cc7d8a61e 100644 --- a/locale/pot/pgrouting_doc_strings.pot +++ b/locale/pot/pgrouting_doc_strings.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: pgRouting v4.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-06-11 19:19+0000\n" +"POT-Creation-Date: 2025-06-12 15:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3598,7 +3598,10 @@ msgstr "" msgid "pgr_pushRelabel(Combinations)" msgstr "" -msgid "SQL signatures modification on functions" +msgid "SQL signatures and output standardization" +msgstr "" + +msgid "`#2904 `__ Standardize output columns of functions with different output columns within overloads" msgstr "" msgid "Official functions" @@ -3610,6 +3613,15 @@ msgstr "" msgid "Combinations signature promoted to official." msgstr "" +msgid "`#2905 `__" +msgstr "" + +msgid "pgr_withPoints" +msgstr "" + +msgid "`#2907 `__ pgr_bellmanFord" +msgstr "" + msgid "`#2910 `__ pgr_edwardMoore" msgstr "" @@ -3970,7 +3982,10 @@ msgstr "" msgid ":doc:`pgr_bdDijkstra` [1]_" msgstr "" -msgid "``pgr_edwardMoore`` [3]_" +msgid ":doc:`pgr_bellmanFord` [3]_" +msgstr "" + +msgid ":doc:`pgr_edwardMoore` [3]_" msgstr "" msgid ":doc:`pgr_withPoints` [2]_" @@ -4105,31 +4120,34 @@ msgstr "" msgid "THe standardized :ref:`pgRouting-concepts:Result columns for single path functions` are |short-generic-result|" msgstr "" -msgid "``pgr_aStar``" +msgid "``pgr_dijkstra``" msgstr "" -msgid "v < 3.6" +msgid "v < 3.5" msgstr "" msgid "|old-generic-result|" msgstr "" -msgid "``pgr_dijkstra``" +msgid "``pgr_aStar``" msgstr "" -msgid "v < 3.5" +msgid "v < 3.6" msgstr "" msgid "``pgr_bdDijkstra``" msgstr "" -msgid "``pgr_withPoints``" +msgid "``pgr_bellmanFord``" msgstr "" -msgid "|old-pid-result|" +msgid "``pgr_edwardMoore``" msgstr "" -msgid "``pgr_edwardMoore``" +msgid "``pgr_withPoints``" +msgstr "" + +msgid "|old-pid-result|" msgstr "" msgid "Migration of |old-generic-result|" @@ -7555,18 +7573,6 @@ msgstr "" msgid "pgr_bellmanFord(`Edges SQL`_, `Combinations SQL`_, [``directed``])" msgstr "" -msgid "Returns set of |result-1-1|" -msgstr "" - -msgid "Returns set of |result-1-m|" -msgstr "" - -msgid "Returns set of |result-m-1|" -msgstr "" - -msgid "Using a combinations table on an **undirected** graph." -msgstr "" - msgid "`Boost: Bellman Ford `__" msgstr "" @@ -7732,6 +7738,15 @@ msgstr "" msgid "**Note:** Using the :doc:`sampledata` Network as all weights are same (i.e :math:`1``)" msgstr "" +msgid "Returns set of |result-1-1|" +msgstr "" + +msgid "Returns set of |result-1-m|" +msgstr "" + +msgid "Returns set of |result-m-1|" +msgstr "" + msgid "`Boost: Breadth First Search `__" msgstr "" @@ -10078,6 +10093,9 @@ msgstr "" msgid "pgr_edwardMoore(`Edges SQL`_, `Combinations SQL`_, [``directed``])" msgstr "" +msgid "Using a combinations table on an **undirected** graph." +msgstr "" + msgid "https://en.wikipedia.org/wiki/Shortest_Path_Faster_Algorithm" msgstr "" diff --git a/pgtap/bellman_ford/bellman_ford/types_check.pg b/pgtap/bellman_ford/bellman_ford/types_check.pg index d4ab1959318..9b5a5bed7e0 100644 --- a/pgtap/bellman_ford/bellman_ford/types_check.pg +++ b/pgtap/bellman_ford/bellman_ford/types_check.pg @@ -19,90 +19,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT plan(13); - -CREATE OR REPLACE FUNCTION types_check() -RETURNS SETOF TEXT AS -$BODY$ -BEGIN - - RETURN QUERY SELECT has_function('pgr_bellmanford'); - - RETURN QUERY SELECT has_function('pgr_bellmanford', ARRAY['text','bigint','bigint','boolean']); - RETURN QUERY SELECT has_function('pgr_bellmanford', ARRAY['text','bigint','anyarray','boolean']); - RETURN QUERY SELECT has_function('pgr_bellmanford', ARRAY['text','anyarray','bigint','boolean']); - RETURN QUERY SELECT has_function('pgr_bellmanford', ARRAY['text','anyarray','anyarray','boolean']); - - RETURN QUERY SELECT function_returns('pgr_bellmanford', ARRAY['text','bigint','bigint','boolean'], 'setof record'); - RETURN QUERY SELECT function_returns('pgr_bellmanford', ARRAY['text','bigint','anyarray','boolean'], 'setof record'); - RETURN QUERY SELECT function_returns('pgr_bellmanford', ARRAY['text','anyarray','bigint','boolean'], 'setof record'); - RETURN QUERY SELECT function_returns('pgr_bellmanford', ARRAY['text','anyarray','anyarray','boolean'], 'setof record'); - - RETURN QUERY - SELECT CASE - WHEN min_version('3.2.0') THEN - collect_tap( - has_function('pgr_bellmanford', ARRAY['text','text','boolean']), - function_returns('pgr_bellmanford', ARRAY['text','text','boolean'], 'setof record') - ) - ELSE - skip(2, 'Combinations signature added on version 3.2.0') - END; - - RETURN QUERY - SELECT CASE - WHEN min_version('3.2.0') THEN - collect_tap( - - function_args_eq('pgr_bellmanford', - $$VALUES - ('{"","","","directed","seq","path_seq","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","start_vid","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","end_vid","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","start_vid","end_vid","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","",directed,seq,path_seq,start_vid,end_vid,node,edge,cost,agg_cost}'::TEXT[]) - $$ - ), - - function_types_eq('pgr_bellmanford', - $$VALUES - ('{text,int8,int8,bool,int4,int4,int8,int8,float8,float8}'::TEXT[]), - ('{text,int8,anyarray,bool,int4,int4,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,anyarray,int8,bool,int4,int4,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,anyarray,anyarray,bool,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,text,bool,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]) - $$ - ) - ) - ELSE - collect_tap( - - function_args_eq('pgr_bellmanford', - $$VALUES - ('{"","","","directed","seq","path_seq","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","start_vid","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","end_vid","node","edge","cost","agg_cost"}'::TEXT[]), - ('{"","","","directed","seq","path_seq","start_vid","end_vid","node","edge","cost","agg_cost"}'::TEXT[]) - $$ - ), - - function_types_eq('pgr_bellmanford', - $$VALUES - ('{text,int8,int8,bool,int4,int4,int8,int8,float8,float8}'::TEXT[]), - ('{text,int8,anyarray,bool,int4,int4,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,anyarray,int8,bool,int4,int4,int8,int8,int8,float8,float8}'::TEXT[]), - ('{text,anyarray,anyarray,bool,int4,int4,int8,int8,int8,int8,float8,float8}'::TEXT[]) - $$ - ) - ) - END; - -END; -$BODY$ -LANGUAGE plpgsql; - -SELECT types_check(); +SELECT CASE WHEN min_version('4.0.0') THEN plan(13) WHEN min_version('3.2.0') THEN plan(12) ELSE PLAN(10) END; +SELECT single_path_types_check('pgr_bellmanford', standard_v => '4.0.0'); SELECT finish(); ROLLBACK; diff --git a/sql/bellman_ford/bellman_ford.sql b/sql/bellman_ford/bellman_ford.sql index 904d5df24d8..e8712519901 100644 --- a/sql/bellman_ford/bellman_ford.sql +++ b/sql/bellman_ford/bellman_ford.sql @@ -6,7 +6,7 @@ Mail: project@pgrouting.org Function's developer: Copyright (c) 2018 Sourabh Garg -Mail: sourabh.garg.mat@gmail.com +Mail: sourabh.garg.mat at gmail.com ------ @@ -26,12 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ------------------- --- pgr_bellmanFord ------------------- - - ---ONE TO ONE +-- ONE TO ONE --v3.0 CREATE FUNCTION pgr_bellmanFord( TEXT, -- edges_sql (required) @@ -42,6 +37,8 @@ CREATE FUNCTION pgr_bellmanFord( OUT seq INTEGER, OUT path_seq INTEGER, + OUT start_vid BIGINT, + OUT end_vid BIGINT, OUT node BIGINT, OUT edge BIGINT, OUT cost FLOAT, @@ -49,8 +46,8 @@ CREATE FUNCTION pgr_bellmanFord( RETURNS SETOF RECORD AS $BODY$ - SELECT a.seq, a.path_seq, a.node, a.edge, a.cost, a.agg_cost - FROM _pgr_bellmanFord(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], directed, false) AS a; + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_bellmanFord(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], ARRAY[$3]::BIGINT[], directed, false); $BODY$ LANGUAGE SQL VOLATILE STRICT; @@ -67,16 +64,16 @@ CREATE FUNCTION pgr_bellmanFord( OUT seq INTEGER, OUT path_seq INTEGER, + OUT start_vid BIGINT, OUT end_vid BIGINT, OUT node BIGINT, OUT edge BIGINT, OUT cost FLOAT, OUT agg_cost FLOAT) - RETURNS SETOF RECORD AS $BODY$ - SELECT a.seq, a.path_seq, a.end_vid, a.node, a.edge, a.cost, a.agg_cost - FROM _pgr_bellmanFord(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], directed, false) AS a; + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_bellmanFord(_pgr_get_statement($1), ARRAY[$2]::BIGINT[], $3::BIGINT[], directed, false); $BODY$ LANGUAGE SQL VOLATILE STRICT; @@ -93,6 +90,7 @@ CREATE FUNCTION pgr_bellmanFord( OUT seq INTEGER, OUT path_seq INTEGER, OUT start_vid BIGINT, + OUT end_vid BIGINT, OUT node BIGINT, OUT edge BIGINT, OUT cost FLOAT, @@ -100,8 +98,8 @@ CREATE FUNCTION pgr_bellmanFord( RETURNS SETOF RECORD AS $BODY$ - SELECT a.seq, a.path_seq, a.start_vid, a.node, a.edge, a.cost, a.agg_cost - FROM _pgr_bellmanFord(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], directed, false) AS a; + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_bellmanFord(_pgr_get_statement($1), $2::BIGINT[], ARRAY[$3]::BIGINT[], directed, false); $BODY$ LANGUAGE SQL VOLATILE STRICT; @@ -126,8 +124,8 @@ CREATE FUNCTION pgr_bellmanFord( RETURNS SETOF RECORD AS $BODY$ - SELECT a.seq, a.path_seq, a.start_vid, a.end_vid, a.node, a.edge, a.cost, a.agg_cost - FROM _pgr_bellmanFord(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], directed, false ) AS a; + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_bellmanFord(_pgr_get_statement($1), $2::BIGINT[], $3::BIGINT[], directed, false ); $BODY$ LANGUAGE sql VOLATILE STRICT; @@ -151,20 +149,17 @@ CREATE FUNCTION pgr_bellmanFord( RETURNS SETOF RECORD AS $BODY$ - SELECT a.seq, a.path_seq, a.start_vid, a.end_vid, a.node, a.edge, a.cost, a.agg_cost - FROM _pgr_bellmanFord(_pgr_get_statement($1), _pgr_get_statement($2), directed, false ) AS a; + SELECT seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost + FROM _pgr_bellmanFord(_pgr_get_statement($1), _pgr_get_statement($2), directed, false); $BODY$ LANGUAGE SQL VOLATILE STRICT; --- COMMENTS - - COMMENT ON FUNCTION pgr_bellmanFord(TEXT, BIGINT, BIGINT, BOOLEAN) IS 'pgr_bellmanFord(One to One) - EXPERIMENTAL - Parameters: - - edges SQL with columns: id, source, target, cost [,reverse_cost] + - Edges SQL with columns: id, source, target, cost [,reverse_cost] - From vertex identifier - To vertex identifier - Optional Parameters: diff --git a/sql/scripts/build-extension-update-files.pl b/sql/scripts/build-extension-update-files.pl index 47bfc9c1f61..27656d99d3b 100755 --- a/sql/scripts/build-extension-update-files.pl +++ b/sql/scripts/build-extension-update-files.pl @@ -272,34 +272,42 @@ sub generate_upgrade_script { push @commands, drop_special_case_function("pgr_kruskaldd(text,anyarray,numeric)"); push @commands, drop_special_case_function("pgr_kruskaldd(text,anyarray,double precision)"); } + if ($old_minor >= "3.2") { # Out parameters changed names on v4.0.0 + # Official functions push @commands, drop_special_case_function("pgr_withpoints(text,text,text,boolean,character,boolean)"); push @commands, drop_special_case_function("pgr_withpointscost(text,text,text,boolean,character)"); } # Row type defined by OUT parameters is different. - push @commands, drop_special_case_function("pgr_bddijkstra(text,bigint,bigint,boolean)"); - push @commands, drop_special_case_function("pgr_bddijkstra(text,anyarray,bigint,boolean)"); - push @commands, drop_special_case_function("pgr_bddijkstra(text,bigint,anyarray,boolean)"); + # Out parameters changed names on v4.0.0 + # Experimental functions + + push @commands, drop_special_case_function("pgr_bellmanford(text,bigint,bigint,boolean)"); + push @commands, drop_special_case_function("pgr_bellmanford(text,anyarray,bigint,boolean)"); + push @commands, drop_special_case_function("pgr_bellmanford(text,bigint,anyarray,boolean)"); push @commands, drop_special_case_function("pgr_edwardmoore(text,bigint,bigint,boolean)"); push @commands, drop_special_case_function("pgr_edwardmoore(text,anyarray,bigint,boolean)"); push @commands, drop_special_case_function("pgr_edwardmoore(text,bigint,anyarray,boolean)"); - # Out parameters changed names on v4.0.0 + # Official functions + push @commands, drop_special_case_function("pgr_bddijkstra(text,bigint,bigint,boolean)"); + push @commands, drop_special_case_function("pgr_bddijkstra(text,anyarray,bigint,boolean)"); + push @commands, drop_special_case_function("pgr_bddijkstra(text,bigint,anyarray,boolean)"); + push @commands, drop_special_case_function("pgr_withpoints(text,text,anyarray,anyarray,boolean,character,boolean)"); push @commands, drop_special_case_function("pgr_withpoints(text,text,anyarray,bigint,boolean,character,boolean)"); push @commands, drop_special_case_function("pgr_withpoints(text,text,bigint,anyarray,boolean,character,boolean)"); push @commands, drop_special_case_function("pgr_withpoints(text,text,bigint,bigint,boolean,character,boolean)"); - # Out parameters changed names on v4.0.0 push @commands, drop_special_case_function("pgr_withpointscost(text,text,anyarray,anyarray,boolean,character)"); push @commands, drop_special_case_function("pgr_withpointscost(text,text,anyarray,bigint,boolean,character)"); push @commands, drop_special_case_function("pgr_withpointscost(text,text,bigint,anyarray,boolean,character)"); push @commands, drop_special_case_function("pgr_withpointscost(text,text,bigint,bigint,boolean,character)"); - # Out parameters changed names on v4.0.0 + push @commands, drop_special_case_function("pgr_withpointscostmatrix(text,text,anyarray,boolean,character)"); } }