Skip to content

Commit

Permalink
[toposort] add queries files
Browse files Browse the repository at this point in the history
  • Loading branch information
nike0good authored and nike0good committed Jun 9, 2019
1 parent 5d76ad0 commit 75c2cb3
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 1 deletion.
44 changes: 44 additions & 0 deletions doc/queries/doc-topologicalSort.queries
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
SELECT * FROM pgr_topologicalSort(
'SELECT id, source, target, cost, reverse_cost FROM edge_table'
);
ERROR: function pgr_topologicalsort(unknown) does not exist
LINE 1: SELECT * FROM pgr_topologicalSort(
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
-- q1
SELECT * FROM pgr_topologicalSort(
'SELECT id, source, target, cost, reverse_cost
FROM edge_table
WHERE id < 17'
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q2
SELECT * FROM pgr_topologicalSort(
'SELECT id, source, target, cost, reverse_cost
FROM edge_table
WHERE id = 18'
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q3
SELECT * FROM pgr_topologicalSort(
$$
SELECT id, source, target, cost, reverse_cost FROM edge_table
where source = any (ARRAY(SELECT node FROM pgr_connectedComponents(
'SELECT id, source, target, cost, reverse_cost FROM edge_table ')
WHERE component = 14)
)
OR
target = any (ARRAY(SELECT node FROM pgr_connectedComponents(
'SELECT id, source, target, cost, reverse_cost FROM edge_table ')
WHERE component = 14)
)
$$
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q4
ROLLBACK;
ROLLBACK
44 changes: 44 additions & 0 deletions test/topologicalSort/doc-topologicalSort.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
BEGIN;
BEGIN
SET client_min_messages TO NOTICE;
SET
SELECT * FROM pgr_topologicalSort(
\'SELECT id, source, target, cost, reverse_cost FROM edge_table\'
);
ERROR: function pgr_topologicalsort(unknown) does not exist
LINE 1: SELECT * FROM pgr_topologicalSort(
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
-- q1
SELECT * FROM pgr_topologicalSort(
\'SELECT id, source, target, cost, reverse_cost
FROM edge_table
WHERE id < 17\'
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q2
SELECT * FROM pgr_topologicalSort(
\'SELECT id, source, target, cost, reverse_cost
FROM edge_table
WHERE id = 18\'
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q3
SELECT * FROM pgr_topologicalSort(
$$
SELECT id, source, target, cost, reverse_cost FROM edge_table
where source = any (ARRAY(SELECT node FROM pgr_connectedComponents(
\'SELECT id, source, target, cost, reverse_cost FROM edge_table \')
WHERE component = 14)
)
OR
target = any (ARRAY(SELECT node FROM pgr_connectedComponents(
\'SELECT id, source, target, cost, reverse_cost FROM edge_table \')
WHERE component = 14)
)
$$
);
ERROR: current transaction is aborted, commands ignored until end of transaction block
-- q4
ROLLBACK;
ROLLBACK
4 changes: 4 additions & 0 deletions test/topologicalSort/doc-topologicalSort.test.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
SELECT * FROM pgr_topologicalSort(
'SELECT id, source, target, cost, reverse_cost FROM edge_table'
);

\echo -- q1
SELECT * FROM pgr_topologicalSort(
'SELECT id, source, target, cost, reverse_cost
Expand Down
2 changes: 1 addition & 1 deletion test/topologicalSort/test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

%main::tests = (
'any' => {
'comment' => 'topologicalSort algorithm tets.',
'comment' => 'topologicalSort algorithm tests.',
'data' => [ ],
'tests' => [qw(
doc-topologicalSort
Expand Down

0 comments on commit 75c2cb3

Please sign in to comment.