66SELECT * FROM pgr_contractionLinear(
77 'SELECT id, source, target, cost, reverse_cost FROM edges',
88 directed => false);
9- ERROR: function pgr_contractionlinear(unknown, directed => boolean) does not exist
10- LINE 2: SELECT * FROM pgr_contractionLinear(
11- ^
12- HINT: No function matches the given name and argument types. You might need to add explicit type casts.
9+ type | id | contracted_vertices | source | target | cost
10+ ------+----+---------------------+--------+--------+------
11+ e | -1 | {3} | 1 | 7 | 2
12+ e | -2 | {17} | 12 | 16 | 2
13+ e | -3 | {15} | 10 | 16 | 2
14+ (3 rows)
15+
1316/* -- q2 */
1417SELECT * FROM pgr_contractionLinear(
1518$$SELECT * FROM (VALUES
1619 (1, 1, 2, 1, -1),
1720 (2, 2, 3, 3, 4))
1821 AS edges(id,source,target,cost,reverse_cost)$$,
1922 directed => true);
20- ERROR: current transaction is aborted, commands ignored until end of transaction block
23+ type | id | contracted_vertices | source | target | cost
24+ ------+----+---------------------+--------+--------+------
25+ (0 rows)
26+
2127/* -- q3 */
2228SELECT * FROM pgr_contractionLinear(
2329$$SELECT * FROM (VALUES
2430 (1, 1, 2, 1, -1),
2531 (2, 2, 3, 3, 4))
2632 AS edges(id,source,target,cost,reverse_cost)$$,
2733 directed => false);
28- ERROR: current transaction is aborted, commands ignored until end of transaction block
34+ type | id | contracted_vertices | source | target | cost
35+ ------+----+---------------------+--------+--------+------
36+ e | -1 | {2} | 1 | 3 | 4
37+ (1 row)
38+
2939/* -- q4 */
3040SELECT * FROM pgr_contractionLinear(
3141$$SELECT * FROM (VALUES
3242 (1, 1, 2, 1, 2),
3343 (2, 2, 3, 3, 4))
3444 AS edges(id,source,target,cost,reverse_cost)$$,
3545 directed => true);
36- ERROR: current transaction is aborted, commands ignored until end of transaction block
46+ type | id | contracted_vertices | source | target | cost
47+ ------+----+---------------------+--------+--------+------
48+ e | -1 | {2} | 1 | 3 | 4
49+ e | -2 | {2} | 3 | 1 | 6
50+ (2 rows)
51+
3752/* -- q5 */
3853SELECT * FROM pgr_contractionLinear(
3954$$SELECT * FROM (VALUES
4055 (1, 1, 2, 1, 2),
4156 (2, 2, 3, 3, 4))
4257 AS edges(id,source,target,cost,reverse_cost)$$,
4358 directed => false);
44- ERROR: current transaction is aborted, commands ignored until end of transaction block
59+ type | id | contracted_vertices | source | target | cost
60+ ------+----+---------------------+--------+--------+------
61+ e | -1 | {2} | 1 | 3 | 4
62+ (1 row)
63+
4564/* -- q6 */
4665SELECT * FROM pgr_contractionLinear(
4766$$SELECT * FROM (VALUES
4867 (1, 1, 2, 1),
4968 (2, 2, 3, 1),
5069 (2, 3, 4, 1))
5170 AS edges(id,source,target,cost)$$);
52- ERROR: current transaction is aborted, commands ignored until end of transaction block
71+ type | id | contracted_vertices | source | target | cost
72+ ------+----+---------------------+--------+--------+------
73+ e | -1 | {2,3} | 1 | 4 | 3
74+ (1 row)
75+
5376/* -- q7 */
5477/* -- cg1 */
5578ALTER TABLE vertices ADD is_contracted BOOLEAN DEFAULT false;
56- ERROR: current transaction is aborted, commands ignored until end of transaction block
79+ ALTER TABLE
5780ALTER TABLE edges ADD is_new BOOLEAN DEFAULT false;
58- ERROR: current transaction is aborted, commands ignored until end of transaction block
81+ ALTER TABLE
5982ALTER TABLE edges ADD contracted_vertices BIGINT[];
60- ERROR: current transaction is aborted, commands ignored until end of transaction block
83+ ALTER TABLE
6184/* -- cg2 */
6285SELECT * INTO contraction_results
6386FROM pgr_contractionLinear(
6487 'SELECT id, source, target, cost, reverse_cost FROM edges',
6588 directed => false);
66- ERROR: current transaction is aborted, commands ignored until end of transaction block
89+ SELECT 3
6790/* -- cg3 */
6891UPDATE vertices
6992SET is_contracted = true
7093WHERE id IN (SELECT unnest(contracted_vertices) FROM contraction_results);
71- ERROR: current transaction is aborted, commands ignored until end of transaction block
94+ UPDATE 3
7295/* -- cg4 */
7396SELECT id, is_contracted
7497FROM vertices WHERE is_contracted ORDER BY id;
75- ERROR: current transaction is aborted, commands ignored until end of transaction block
98+ id | is_contracted
99+ ----+---------------
100+ 3 | t
101+ 15 | t
102+ 17 | t
103+ (3 rows)
104+
76105/* -- cg5 */
77106INSERT INTO edges(source, target, cost, reverse_cost, contracted_vertices, is_new)
78107SELECT source, target, cost, -1, contracted_vertices, true
79108FROM contraction_results;
80- ERROR: current transaction is aborted, commands ignored until end of transaction block
109+ INSERT 0 3
81110/* -- cg6 */
82111CREATE VIEW contracted_graph AS
83112WITH
@@ -89,14 +118,38 @@ FROM edges
89118WHERE source IN (SELECT * FROM vertices_in_graph)
90119AND target IN (SELECT * FROM vertices_in_graph)
91120ORDER BY id;
92- ERROR: current transaction is aborted, commands ignored until end of transaction block
121+ CREATE VIEW
93122/* -- cg7 */
94123SELECT * FROM contracted_graph ORDER by id;
95- ERROR: current transaction is aborted, commands ignored until end of transaction block
124+ id | source | target | cost | reverse_cost
125+ ----+--------+--------+------+--------------
126+ 1 | 5 | 6 | 1 | 1
127+ 2 | 6 | 10 | -1 | 1
128+ 4 | 6 | 7 | 1 | 1
129+ 5 | 10 | 11 | 1 | -1
130+ 8 | 7 | 11 | 1 | 1
131+ 9 | 11 | 16 | 1 | 1
132+ 10 | 7 | 8 | 1 | 1
133+ 11 | 11 | 12 | 1 | -1
134+ 12 | 8 | 12 | 1 | -1
135+ 14 | 8 | 9 | 1 | 1
136+ 17 | 2 | 4 | 1 | 1
137+ 18 | 13 | 14 | 1 | 1
138+ 19 | 1 | 7 | 2 | -1
139+ 20 | 12 | 16 | 2 | -1
140+ 21 | 10 | 16 | 2 | -1
141+ (15 rows)
142+
96143/* -- cg8 */
97144SELECT *
98145FROM pgr_dijkstra('SELECT * FROM contracted_graph', 7, 16);
99- ERROR: current transaction is aborted, commands ignored until end of transaction block
146+ seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
147+ -----+----------+-----------+---------+------+------+------+----------
148+ 1 | 1 | 7 | 16 | 7 | 8 | 1 | 0
149+ 2 | 2 | 7 | 16 | 11 | 9 | 1 | 1
150+ 3 | 3 | 7 | 16 | 16 | -1 | 0 | 2
151+ (3 rows)
152+
100153/* -- cg9 */
101154SELECT * FROM pgr_dijkstra(
102155 'WITH in_line AS (SELECT contracted_vertices FROM edges WHERE 17 = ANY(contracted_vertices))
@@ -108,7 +161,15 @@ SELECT * FROM pgr_dijkstra(
108161
109162 SELECT id, source, target, cost, reverse_cost FROM contracted_graph',
110163 1, 17);
111- ERROR: current transaction is aborted, commands ignored until end of transaction block
164+ seq | path_seq | start_vid | end_vid | node | edge | cost | agg_cost
165+ -----+----------+-----------+---------+------+------+------+----------
166+ 1 | 1 | 1 | 17 | 1 | 19 | 2 | 0
167+ 2 | 2 | 1 | 17 | 7 | 8 | 1 | 2
168+ 3 | 3 | 1 | 17 | 11 | 9 | 1 | 3
169+ 4 | 4 | 1 | 17 | 16 | 15 | 1 | 4
170+ 5 | 5 | 1 | 17 | 17 | -1 | 0 | 5
171+ (5 rows)
172+
112173/* -- cg10 */
113174ROLLBACK;
114175ROLLBACK
0 commit comments