]> granicus.if.org Git - postgresql/commitdiff
Eliminate unnecessary array[] decoration in examples of recursive cycle
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Oct 2008 00:12:44 +0000 (00:12 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 14 Oct 2008 00:12:44 +0000 (00:12 +0000)
detection.

doc/src/sgml/queries.sgml
src/test/regress/expected/with.out
src/test/regress/sql/with.sql

index 0232d80db71a8cdfed632d441dc2a727e0119bfe..ef9383a2f71ad6a4551c0399fdcc1d7a63910e5a 100644 (file)
@@ -1,4 +1,4 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/queries.sgml,v 1.48 2008/10/13 16:25:19 tgl Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/queries.sgml,v 1.49 2008/10/14 00:12:44 tgl Exp $ -->
 
 <chapter id="queries">
  <title>Queries</title>
@@ -1639,7 +1639,7 @@ WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS (
         FROM graph g
       UNION ALL
         SELECT g.id, g.link, g.data, sg.depth + 1,
-          path || ARRAY[g.id],
+          path || g.id,
           g.id = ANY(path)
         FROM graph g, search_graph sg
         WHERE g.id = sg.link AND NOT cycle
@@ -1664,7 +1664,7 @@ WITH RECURSIVE search_graph(id, link, data, depth, path, cycle) AS (
         FROM graph g
       UNION ALL
         SELECT g.id, g.link, g.data, sg.depth + 1,
-          path || ARRAY[ROW(g.f1, g.f2)],
+          path || ROW(g.f1, g.f2),
           ROW(g.f1, g.f2) = ANY(path)
         FROM graph g, search_graph sg
         WHERE g.id = sg.link AND NOT cycle
index e8d3e43b7b60a2a667fab958a6a59f69a03b73a7..765910d48baa8bd4735d7cc13ff874a12a258137 100644 (file)
@@ -465,7 +465,7 @@ insert into graph values
 with recursive search_graph(f, t, label, path, cycle) as (
        select *, array[row(g.f, g.t)], false from graph g
        union all
-       select g.*, path || array[row(g.f, g.t)], row(g.f, g.t) = any(path)
+       select g.*, path || row(g.f, g.t), row(g.f, g.t) = any(path)
        from graph g, search_graph sg
        where g.f = sg.t and not cycle
 )
index d37f0d9723e9d5db279bdf7065b4a5eb41f60741..3107cbcb911c5c19ddbba410759e9c52ac1aceae 100644 (file)
@@ -266,7 +266,7 @@ insert into graph values
 with recursive search_graph(f, t, label, path, cycle) as (
        select *, array[row(g.f, g.t)], false from graph g
        union all
-       select g.*, path || array[row(g.f, g.t)], row(g.f, g.t) = any(path)
+       select g.*, path || row(g.f, g.t), row(g.f, g.t) = any(path)
        from graph g, search_graph sg
        where g.f = sg.t and not cycle
 )