From ea2f89e23451eeae157aa41880aefb46f24bb3cf Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Sun, 26 May 2019 19:40:22 +0200 Subject: [PATCH] Fix non-exhaustive pattern match warning by duplicating a line. --- src/PostgREST/DbRequestBuilder.hs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/PostgREST/DbRequestBuilder.hs b/src/PostgREST/DbRequestBuilder.hs index a2a8911f5..4bdabd115 100644 --- a/src/PostgREST/DbRequestBuilder.hs +++ b/src/PostgREST/DbRequestBuilder.hs @@ -241,12 +241,15 @@ addJoinConditions schema previousAlias (Node node@(query@Select{from=tbl}, nodeP -- previousAlias and newAlias are used in the case of self joins getJoinConditions :: Maybe Alias -> Maybe Alias -> Relation -> [JoinCondition] getJoinConditions previousAlias newAlias (Relation Table{tableSchema=tSchema, tableName=tN} cols Table{tableName=ftN} fCols typ lt lc1 lc2) = - if | typ == Child || typ == Parent -> + case typ of + Child -> zipWith (toJoinCondition tN ftN) cols fCols - | typ == Many -> + Parent -> + zipWith (toJoinCondition tN ftN) cols fCols + Many -> let ltN = maybe "" tableName lt in zipWith (toJoinCondition tN ltN) cols (fromMaybe [] lc1) ++ zipWith (toJoinCondition ftN ltN) fCols (fromMaybe [] lc2) - | typ == Root -> witness + Root -> witness where toJoinCondition :: Text -> Text -> Column -> Column -> JoinCondition toJoinCondition tb ftb c fc =