diff --git a/doc/queries/doc-topologicalSort.queries b/doc/queries/doc-topologicalSort.queries new file mode 100644 index 0000000000..80bbd23668 --- /dev/null +++ b/doc/queries/doc-topologicalSort.queries @@ -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 diff --git a/test/topologicalSort/doc-topologicalSort.result b/test/topologicalSort/doc-topologicalSort.result index e69de29bb2..a343387ddc 100644 --- a/test/topologicalSort/doc-topologicalSort.result +++ b/test/topologicalSort/doc-topologicalSort.result @@ -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 \ No newline at end of file diff --git a/test/topologicalSort/doc-topologicalSort.test.sql b/test/topologicalSort/doc-topologicalSort.test.sql index 21db5398c4..150245355b 100644 --- a/test/topologicalSort/doc-topologicalSort.test.sql +++ b/test/topologicalSort/doc-topologicalSort.test.sql @@ -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 diff --git a/test/topologicalSort/test.conf b/test/topologicalSort/test.conf index 46f7b0fb36..1843c3d68c 100644 --- a/test/topologicalSort/test.conf +++ b/test/topologicalSort/test.conf @@ -2,7 +2,7 @@ %main::tests = ( 'any' => { - 'comment' => 'topologicalSort algorithm tets.', + 'comment' => 'topologicalSort algorithm tests.', 'data' => [ ], 'tests' => [qw( doc-topologicalSort