From de384d0427fb85f00250b4a377189bb6ea308eb8 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Fri, 29 Jul 2016 23:27:26 +0000 Subject: [PATCH] Persistent graph: Cyclic: Remove `start` temp table, not needed anymore --- src/Database/Persist/Sql/Graph/Cyclic.hs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Database/Persist/Sql/Graph/Cyclic.hs b/src/Database/Persist/Sql/Graph/Cyclic.hs index d901202..378ca39 100644 --- a/src/Database/Persist/Sql/Graph/Cyclic.hs +++ b/src/Database/Persist/Sql/Graph/Cyclic.hs @@ -54,14 +54,11 @@ import Database.Persist.Local.Sql.Orphan.Common -- looks like, to help navigate the code: -- -- > WITH RECURSIVE --- > start (id, path, cycle) AS ( +-- > temp (id, path, cycle) AS ( -- > SELECT node.id, ARRAY[node.id], false -- > FROM node LEFT OUTER JOIN edge -- > ON node.id = edge.parent -- > WHERE edge.parent IS NULL --- > ), --- > temp (id, path, cycle) AS ( --- > SELECT * from start -- > UNION ALL -- > SELECT edge.parent, -- > temp.path || edge.parent, @@ -161,18 +158,11 @@ xcyclicn' follow filter minitials proxy = do sql = mconcat [ "WITH RECURSIVE " - , dbname start - , " (" - , T.intercalate "," $ map dbname [tid, tpath, tcycle] - , ") AS ( " - , sqlStart - , " ), " , dbname temp , " (" , T.intercalate "," $ map dbname [tid, tpath, tcycle] - , ") AS ( SELECT " - , "* FROM " - , dbname start + , ") AS (" + , sqlStart , " UNION ALL " , case follow of