diff --git a/NEWS.md b/NEWS.md index 2a6849a2097..e0882b8c7d6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -49,6 +49,10 @@ Summary of changes by function * Output columns standardized to ``(seq, path_seq, start_vid, end_vid, node, edge, cost, agg_cost)`` +* pgr_bipartite + + * Output columns standardized to ``(node, color)`` + * pgr_contraction .. Breaking change @@ -267,6 +271,11 @@ Standardize output columns of functions with different output columns within ove * [#2924](https://github.com/pgRouting/pgrouting/issues/2924) pgr_edgeColoring +**Standardized to ``(node, color)``** + +* [#2924](https://github.com/pgRouting/pgrouting/issues/2924) + pgr_bipartite + Removal of SQL deprecated signatures * [#2798](https://github.com/pgRouting/pgrouting/issues/2798): diff --git a/doc/coloring/coloring-family.rst b/doc/coloring/coloring-family.rst index 496e600ab8e..55f2bf1fdaf 100644 --- a/doc/coloring/coloring-family.rst +++ b/doc/coloring/coloring-family.rst @@ -65,6 +65,22 @@ Column Type Description .. result-edge-color-end +.. result-node-color-start + +Returns set of |result_node_color| + +============ =========== ===================================== +Column Type Description +============ =========== ===================================== +``node`` ``BIGINT`` Identifier of the node. +``color`` ``BIGINT`` Color of the node. + + - The minimum value of color is 1. + +============ =========== ===================================== + +.. result-node-color-end + .. result columns start Returns set of ``(vertex_id, color_id)`` diff --git a/doc/coloring/pgr_bipartite.rst b/doc/coloring/pgr_bipartite.rst index 971b9d0c4bc..180fa8be0bf 100644 --- a/doc/coloring/pgr_bipartite.rst +++ b/doc/coloring/pgr_bipartite.rst @@ -25,9 +25,13 @@ the same set are adjacent. .. rubric:: Availability -* Version 3.2.0 +.. rubric:: Version 4.0.0 - * New experimental function. +* Output columns standardized to |result_node_color| + +.. rubric:: Version 3.2.0 + +* New experimental function. Description ------------------------------------------------------------------------------- @@ -56,7 +60,7 @@ Signatures | pgr_bipartite(`Edges SQL`_) - | Returns set of |result-node-color| + | Returns set of |result_node_color| | OR EMPTY SET :Example: When the graph is bipartite @@ -86,8 +90,8 @@ Result columns ------------------------------------------------------------------------------- .. include:: coloring-family.rst - :start-after: result columns start - :end-before: result columns end + :start-after: result-node-color-start + :end-before: result-node-color-end Additional Example -------------------------------------------------------------------------------- diff --git a/doc/conf.py.in b/doc/conf.py.in index cd96132fa3b..eca89e7012a 100644 --- a/doc/conf.py.in +++ b/doc/conf.py.in @@ -365,6 +365,7 @@ rst_epilog=""" .. |result-1-1-no-seq| replace:: ``(seq, node, edge, cost, agg_cost)`` .. |result-m-1-no-seq| replace:: ``(seq, start_vid, node, edge, cost, agg_cost)`` .. |result-node-color| replace:: ``(vertex_id, color_id)`` +.. |result_node_color| replace:: ``(node, color)`` .. |result_edge_color| replace:: ``(edge, color)`` .. |result-node| replace:: ``(node)`` .. |result-edge| replace:: ``(edge)`` diff --git a/doc/src/migration.rst b/doc/src/migration.rst index 23f37ce70f0..d0709e57a73 100644 --- a/doc/src/migration.rst +++ b/doc/src/migration.rst @@ -34,6 +34,7 @@ Migration to standardized columns .. |pid-m-m| replace:: ``(seq, path_seq, start_pid, end_pid, node, edge, cost, agg_cost)`` .. |matrix-pid| replace:: ``(start_pid, end_pid, agg_cost)`` .. |old-edge-color| replace:: ``(edge_id, color_id)`` +.. |old-node-color| replace:: ``(vertex_id, color_id)`` There has been an effort to standardize function output columns names and types. @@ -84,6 +85,8 @@ types. - `Migration of single path functions`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_binaryBreadthFirstSearch` [3]_ - `Migration of single path functions`_ + * - .. versionchanged:: 4.0.0 :doc:`pgr_bipartite` [3]_ + - `Migration of output column name change`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_dagShortestPath` [3]_ - `Migration of single path functions`_ * - .. versionchanged:: 4.0.0 :doc:`pgr_edgeColoring` [3]_ @@ -854,6 +857,17 @@ Before update: * To get the old version column names: in the ``SELECT`` clause use ``edge AS edge_id`` and ``color AS color_id`` +.. rubric:: :doc:`pgr_bipartite` + +From: |old-node-color| +To: |result-node-color| + +Before update: + +* Rename ``vertex_id`` to ``node`` and ``color_id`` to ``color``. +* To get the old version column names: in the ``SELECT`` clause use ``node AS + vertex_id`` and ``color AS color_id`` + Migration of deleted functions +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/doc/src/release_notes.rst b/doc/src/release_notes.rst index 6d410561dbb..68c205ceffd 100644 --- a/doc/src/release_notes.rst +++ b/doc/src/release_notes.rst @@ -98,6 +98,12 @@ Summary of changes by function :start-after: Version 4.0.0 :end-before: .. rubric +* pgr_bipartite + + .. include:: pgr_bipartite.rst + :start-after: Version 4.0.0 + :end-before: .. rubric + * pgr_contraction .. include:: pgr_contraction.rst @@ -299,6 +305,11 @@ Standardize output columns of functions with different output columns within ove * `#2924 `__ pgr_edgeColoring +.. rubric:: Standardized to |result_node_color| + +* `#2924 `__ + pgr_bipartite + Removal of SQL deprecated signatures ............................................................................... diff --git a/docqueries/coloring/bipartite.pg b/docqueries/coloring/bipartite.pg index bf5a8bb8427..23395ab2afc 100644 --- a/docqueries/coloring/bipartite.pg +++ b/docqueries/coloring/bipartite.pg @@ -3,7 +3,7 @@ /* --q1 */ SELECT * FROM pgr_bipartite( $$SELECT id, source, target, cost, reverse_cost FROM edges$$ -) ORDER BY vertex_id; +) ORDER BY node; /* --q2 */ INSERT INTO edges (source, target, cost, reverse_cost) VALUES (5, 1, 1, 1); diff --git a/docqueries/coloring/bipartite.result b/docqueries/coloring/bipartite.result index 8a715d1b416..1c573cf6fd7 100644 --- a/docqueries/coloring/bipartite.result +++ b/docqueries/coloring/bipartite.result @@ -5,26 +5,26 @@ SET /* --q1 */ SELECT * FROM pgr_bipartite( $$SELECT id, source, target, cost, reverse_cost FROM edges$$ -) ORDER BY vertex_id; - vertex_id | color_id ------------+---------- - 1 | 0 - 2 | 0 - 3 | 1 - 4 | 1 - 5 | 0 - 6 | 1 - 7 | 0 - 8 | 1 - 9 | 0 - 10 | 0 - 11 | 1 - 12 | 0 - 13 | 0 - 14 | 1 - 15 | 1 - 16 | 0 - 17 | 1 +) ORDER BY node; + node | color +------+------- + 1 | 0 + 2 | 0 + 3 | 1 + 4 | 1 + 5 | 0 + 6 | 1 + 7 | 0 + 8 | 1 + 9 | 0 + 10 | 0 + 11 | 1 + 12 | 0 + 13 | 0 + 14 | 1 + 15 | 1 + 16 | 0 + 17 | 1 (17 rows) /* --q2 */ @@ -35,8 +35,8 @@ INSERT 0 1 SELECT * FROM pgr_bipartite( $$SELECT id, source, target, cost, reverse_cost FROM edges$$ ); - vertex_id | color_id ------------+---------- + node | color +------+------- (0 rows) /* --q4 */ diff --git a/pgtap/coloring/bipartite/types_check.pg b/pgtap/coloring/bipartite/types_check.pg index 5e372b687d2..b7dc1d38bc3 100644 --- a/pgtap/coloring/bipartite/types_check.pg +++ b/pgtap/coloring/bipartite/types_check.pg @@ -19,16 +19,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ BEGIN; -SELECT CASE WHEN NOT min_version('3.2.0') THEN plan(1) ELSE plan(5) END; +SELECT CASE WHEN min_version('4.0.0') THEN plan(5) ELSE plan(1) END; CREATE OR REPLACE FUNCTION types_check() RETURNS SETOF TEXT AS $BODY$ BEGIN - IF NOT min_version('3.2.0') THEN + IF NOT min_version('4.0.0') THEN RETURN QUERY - SELECT skip(1, 'Function is new on 3.2.0'); + SELECT skip(1, 'pgr_bipartite: testing only signatures standardaized in v4.0.0.'); RETURN; END IF; @@ -38,15 +38,14 @@ BEGIN RETURN QUERY SELECT function_args_eq('pgr_bipartite', - $$SELECT '{"","vertex_id","color_id"}'::TEXT[] $$ + $$SELECT '{"","node","color"}'::TEXT[] $$ ); RETURN QUERY SELECT function_types_eq('pgr_bipartite', - $$VALUES - ('{text,int8,int8}'::TEXT[]) - $$ + $$SELECT '{text,int8,int8}'::TEXT[] $$ ); + END; $BODY$ LANGUAGE plpgsql; diff --git a/sql/coloring/bipartite.sql b/sql/coloring/bipartite.sql index 008b4518470..0f9e8798cd1 100644 --- a/sql/coloring/bipartite.sql +++ b/sql/coloring/bipartite.sql @@ -26,25 +26,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ********************************************************************PGR-GNU*/ ---------------- --- pgr_bipartite ---------------- --v3.2 CREATE FUNCTION pgr_bipartite( TEXT, -- edges_sql (required) - OUT vertex_id BIGINT, - OUT color_id BIGINT) + OUT node BIGINT, + OUT color BIGINT) RETURNS SETOF RECORD AS $BODY$ -BEGIN - RETURN QUERY SELECT node, color FROM _pgr_bipartite(_pgr_get_statement($1)); -END; $BODY$ -LANGUAGE plpgsql VOLATILE STRICT; +LANGUAGE SQL VOLATILE STRICT; -- COMMENTS diff --git a/sql/scripts/build-extension-update-files.pl b/sql/scripts/build-extension-update-files.pl index 725dace27f9..bfe6439acb8 100755 --- a/sql/scripts/build-extension-update-files.pl +++ b/sql/scripts/build-extension-update-files.pl @@ -277,6 +277,7 @@ sub generate_upgrade_script { # Out parameters changed names on v4.0.0 # Experimental functions push @commands, drop_special_case_function("pgr_dagshortestpath(text,text)"); + push @commands, drop_special_case_function("pgr_bipartite(text)"); } if ($old_minor >= "3.3") {