mirror of
https://code.sup39.dev/repos/Wqawg
synced 2024-12-29 00:34:54 +09:00
Persistent graph: Cyclic: Remove start
temp table, not needed anymore
This commit is contained in:
parent
9ca7ab3a57
commit
de384d0427
1 changed files with 3 additions and 13 deletions
|
@ -54,14 +54,11 @@ import Database.Persist.Local.Sql.Orphan.Common
|
||||||
-- looks like, to help navigate the code:
|
-- looks like, to help navigate the code:
|
||||||
--
|
--
|
||||||
-- > WITH RECURSIVE
|
-- > WITH RECURSIVE
|
||||||
-- > start (id, path, cycle) AS (
|
-- > temp (id, path, cycle) AS (
|
||||||
-- > SELECT node.id, ARRAY[node.id], false
|
-- > SELECT node.id, ARRAY[node.id], false
|
||||||
-- > FROM node LEFT OUTER JOIN edge
|
-- > FROM node LEFT OUTER JOIN edge
|
||||||
-- > ON node.id = edge.parent
|
-- > ON node.id = edge.parent
|
||||||
-- > WHERE edge.parent IS NULL
|
-- > WHERE edge.parent IS NULL
|
||||||
-- > ),
|
|
||||||
-- > temp (id, path, cycle) AS (
|
|
||||||
-- > SELECT * from start
|
|
||||||
-- > UNION ALL
|
-- > UNION ALL
|
||||||
-- > SELECT edge.parent,
|
-- > SELECT edge.parent,
|
||||||
-- > temp.path || edge.parent,
|
-- > temp.path || edge.parent,
|
||||||
|
@ -161,18 +158,11 @@ xcyclicn' follow filter minitials proxy = do
|
||||||
|
|
||||||
sql = mconcat
|
sql = mconcat
|
||||||
[ "WITH RECURSIVE "
|
[ "WITH RECURSIVE "
|
||||||
, dbname start
|
|
||||||
, " ("
|
|
||||||
, T.intercalate "," $ map dbname [tid, tpath, tcycle]
|
|
||||||
, ") AS ( "
|
|
||||||
, sqlStart
|
|
||||||
, " ), "
|
|
||||||
, dbname temp
|
, dbname temp
|
||||||
, " ("
|
, " ("
|
||||||
, T.intercalate "," $ map dbname [tid, tpath, tcycle]
|
, T.intercalate "," $ map dbname [tid, tpath, tcycle]
|
||||||
, ") AS ( SELECT "
|
, ") AS ("
|
||||||
, "* FROM "
|
, sqlStart
|
||||||
, dbname start
|
|
||||||
|
|
||||||
, " UNION ALL "
|
, " UNION ALL "
|
||||||
, case follow of
|
, case follow of
|
||||||
|
|
Loading…
Reference in a new issue