Persistent graph: Cyclic: Remove start temp table, not needed anymore

This commit is contained in:
fr33domlover 2016-07-29 23:27:26 +00:00
parent 9ca7ab3a57
commit de384d0427

View file

@ -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