Skip to content

Commit 071ee97

Browse files
committed
Standardizing output columns pgr_bipartite to (node,color)
1 parent 468caf7 commit 071ee97

File tree

5 files changed

+29
-35
lines changed

5 files changed

+29
-35
lines changed

docqueries/coloring/bipartite.pg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/* --q1 */
44
SELECT * FROM pgr_bipartite(
55
$$SELECT id, source, target, cost, reverse_cost FROM edges$$
6-
) ORDER BY vertex_id;
6+
) ORDER BY node;
77
/* --q2 */
88
INSERT INTO edges (source, target, cost, reverse_cost) VALUES
99
(5, 1, 1, 1);

docqueries/coloring/bipartite.result

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,26 @@ SET
55
/* --q1 */
66
SELECT * FROM pgr_bipartite(
77
$$SELECT id, source, target, cost, reverse_cost FROM edges$$
8-
) ORDER BY vertex_id;
9-
vertex_id | color_id
10-
-----------+----------
11-
1 | 0
12-
2 | 0
13-
3 | 1
14-
4 | 1
15-
5 | 0
16-
6 | 1
17-
7 | 0
18-
8 | 1
19-
9 | 0
20-
10 | 0
21-
11 | 1
22-
12 | 0
23-
13 | 0
24-
14 | 1
25-
15 | 1
26-
16 | 0
27-
17 | 1
8+
) ORDER BY node;
9+
node | color
10+
------+-------
11+
1 | 0
12+
2 | 0
13+
3 | 1
14+
4 | 1
15+
5 | 0
16+
6 | 1
17+
7 | 0
18+
8 | 1
19+
9 | 0
20+
10 | 0
21+
11 | 1
22+
12 | 0
23+
13 | 0
24+
14 | 1
25+
15 | 1
26+
16 | 0
27+
17 | 1
2828
(17 rows)
2929

3030
/* --q2 */
@@ -35,8 +35,8 @@ INSERT 0 1
3535
SELECT * FROM pgr_bipartite(
3636
$$SELECT id, source, target, cost, reverse_cost FROM edges$$
3737
);
38-
vertex_id | color_id
39-
-----------+----------
38+
node | color
39+
------+-------
4040
(0 rows)
4141

4242
/* --q4 */

pgtap/coloring/bipartite/types_check.pg

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ BEGIN
4343

4444
RETURN QUERY
4545
SELECT function_types_eq('pgr_bipartite',
46-
$$VALUES
47-
('{text,int8,int8}'::TEXT[])
48-
$$
46+
$$SELECT '{text,int8,int8}'::TEXT[] $$
4947
);
48+
5049
END;
5150
$BODY$
5251
LANGUAGE plpgsql;

sql/coloring/bipartite.sql

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,19 @@ along with this program; if not, write to the Free Software
2626
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2727
2828
********************************************************************PGR-GNU*/
29-
---------------
30-
-- pgr_bipartite
31-
---------------
3229

3330
--v3.2
3431
CREATE FUNCTION pgr_bipartite(
3532
TEXT, -- edges_sql (required)
3633

37-
OUT vertex_id BIGINT,
38-
OUT color_id BIGINT)
34+
OUT node BIGINT,
35+
OUT color BIGINT)
3936
RETURNS SETOF RECORD AS
4037
$BODY$
41-
BEGIN
42-
RETURN QUERY
4338
SELECT node, color
4439
FROM _pgr_bipartite(_pgr_get_statement($1));
45-
END;
4640
$BODY$
47-
LANGUAGE plpgsql VOLATILE STRICT;
41+
LANGUAGE SQL VOLATILE STRICT;
4842

4943
-- COMMENTS
5044

sql/scripts/build-extension-update-files.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ sub generate_upgrade_script {
277277
# Out parameters changed names on v4.0.0
278278
# Experimental functions
279279
push @commands, drop_special_case_function("pgr_dagshortestpath(text,text)");
280+
push @commands, drop_special_case_function("pgr_bipartite(text)");
280281
}
281282

282283
if ($old_minor >= "3.3") {

0 commit comments

Comments
 (0)