From 51c99a1dfed0c05c6ce1929fe0f404356e69c507 Mon Sep 17 00:00:00 2001 From: fr33domlover Date: Tue, 2 Aug 2016 11:58:49 +0000 Subject: [PATCH] SQL: Don't list starting nodes in graph reachable set --- src/Database/Persist/Sql/Graph/Reachable.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Database/Persist/Sql/Graph/Reachable.hs b/src/Database/Persist/Sql/Graph/Reachable.hs index 90c1236..6de5ee0 100644 --- a/src/Database/Persist/Sql/Graph/Reachable.hs +++ b/src/Database/Persist/Sql/Graph/Reachable.hs @@ -138,9 +138,10 @@ xreachable' follow filter initials mlen proxy = do , " ) SELECT DISTINCT ", temp ^* tid , " FROM ", dbname temp , " WHERE NOT ", temp ^* tcycle + , " AND array_length(", temp ^* tpath, ", 1) " , case mlen of - Nothing -> "" - Just _ -> " AND array_length(" <> temp ^* tpath <> ", 1) <= ?" + Nothing -> ">= 2" + Just _ -> "BETWEEN 2 AND ?" ] toP = fmap toPersistValue toPL = map toPersistValue