From edc7db8f3fbe4051ddaea73b550c74e28831ea30 Mon Sep 17 00:00:00 2001 From: parsonsmatt Date: Tue, 29 Oct 2019 14:26:09 -0600 Subject: [PATCH] remove debug --- changelog.md | 9 ++++++++- src/Database/Esqueleto/Internal/Internal.hs | 14 -------------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/changelog.md b/changelog.md index cd04b73..4f8b32a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,8 +1,15 @@ +3.2.2 +======== + +- @parsonsmatt + - [#161](https://github.com/bitemyapp/esqueleto/pull/161/): Fix an issue where + nested joins didn't get the right on clause. + 3.2.1 ======== - @parsonsmatt - = [#159](https://github.com/bitemyapp/esqueleto/pull/159): Add an instance of `UnsafeSqlFunction ()` for 0-argument SQL + - [#159](https://github.com/bitemyapp/esqueleto/pull/159): Add an instance of `UnsafeSqlFunction ()` for 0-argument SQL functions. 3.2.0 diff --git a/src/Database/Esqueleto/Internal/Internal.hs b/src/Database/Esqueleto/Internal/Internal.hs index bd5190c..376273d 100644 --- a/src/Database/Esqueleto/Internal/Internal.hs +++ b/src/Database/Esqueleto/Internal/Internal.hs @@ -64,7 +64,6 @@ import qualified Data.Text.Lazy.Builder as TLB import Data.Typeable (Typeable) import Text.Blaze.Html (Html) -import qualified Debug.Trace as Debug import Database.Esqueleto.Internal.ExprParser (TableAccess(..), parseOnExpr) -- | (Internal) Start a 'from' query with an entity. 'from' @@ -1579,7 +1578,6 @@ collectOnClauses -> [FromClause] -> Either (SqlExpr (Value Bool)) [FromClause] collectOnClauses sqlBackend = go Set.empty [] - -- . (\fcs -> Debug.trace (mappend "FromClauses: " (show fcs)) fcs) where go is [] (f@(FromStart i _) : fs) = fmap (f:) (go (Set.insert i is) [] fs) -- fast path @@ -1636,45 +1634,33 @@ collectOnClauses sqlBackend = go Set.empty [] <$> tryMatch idents expr l matchPartial = do - -- Debug.traceM $ "matchPartial" - -- Debug.traceM $ "matchPartial: identsInOnClause: " <> show identsInOnClause - -- Debug.traceM $ "matchPartial: seen idents: " <> show idents ll <- findLeftmostIdent l - -- Debug.traceM $ "matchPartial: ll: " <> show ll rr <- findLeftmostIdent r - -- Debug.traceM $ "matchPartial: rr: " <> show rr guard $ Set.isSubsetOf identsInOnClause (Set.fromList [ll, rr]) - -- Debug.traceM "matchPartial: passed subset check" guard $ k /= CrossJoinKind - -- Debug.traceM "matchPartial: passed cross join kind check" guard $ Maybe.isNothing onClause - -- Debug.traceM "matchPartial: passed isNothing check!" pure (Set.fromList [] <> idents, FromJoin l k r (Just expr)) matchC = case onClause of Nothing | "?" `T.isInfixOf` renderedExpr -> - -- Debug.trace ("matchC success" <> show identsInOnClause) $ return (idents, FromJoin l k r (Just expr)) | Set.null identsInOnClause -> - -- Debug.trace ("matchC success" <> show identsInOnClause) $ return (idents, FromJoin l k r (Just expr)) | otherwise -> Nothing Just _ -> Nothing matchTable = do - -- Debug.traceM $ "matchTable: " <> show identsInOnClause i1 <- findLeftmostIdent r i2 <- findRightmostIdent l guard $ Set.fromList [i1, i2] `Set.isSubsetOf` identsInOnClause guard $ k /= CrossJoinKind guard $ Maybe.isNothing onClause - -- Debug.traceM $ "matchTable: succeed " <> show identsInOnClause pure (Set.fromList [i1, i2] <> idents, FromJoin l k r (Just expr)) _ ->