refactor: Fix typo in QueryBuilder
Signed-off-by: Wolfgang Walther <walther@technowledgy.de>
This commit is contained in:
@@ -111,7 +111,7 @@ getJoin fld node@(Node ReadPlan{relJoinType} _) =
|
||||
in correlatedSubquery subq aggAlias condition
|
||||
|
||||
mutatePlanToQuery :: MutatePlan -> SQL.Snippet
|
||||
mutatePlanToQuery (Insert mainQi iCols body onConflct putConditions returnings _ applyDefaults) =
|
||||
mutatePlanToQuery (Insert mainQi iCols body onConflict putConditions returnings _ applyDefaults) =
|
||||
"INSERT INTO " <> fromQi mainQi <> (if null iCols then " " else "(" <> cols <> ") ") <>
|
||||
fromJsonBodyF body iCols True False applyDefaults <>
|
||||
-- Only used for PUT
|
||||
@@ -128,11 +128,11 @@ mutatePlanToQuery (Insert mainQi iCols body onConflct putConditions returnings _
|
||||
if null iCols
|
||||
then "DO NOTHING"
|
||||
else "DO UPDATE SET " <> intercalateSnippet ", " ((pgFmtIdent . cfName) <> const " = EXCLUDED." <> (pgFmtIdent . cfName) <$> iCols) <> (if null putConditions && not mergeDups then mempty else "WHERE " <> addConfigPgrstInserted False)
|
||||
) onConflct <> " " <>
|
||||
) onConflict <> " " <>
|
||||
returningF mainQi returnings
|
||||
where
|
||||
cols = intercalateSnippet ", " $ pgFmtIdent . cfName <$> iCols
|
||||
mergeDups = case onConflct of {Just (MergeDuplicates,_) -> True; _ -> False;}
|
||||
mergeDups = case onConflict of {Just (MergeDuplicates,_) -> True; _ -> False;}
|
||||
|
||||
-- An update without a limit is always filtered with a WHERE
|
||||
mutatePlanToQuery (Update mainQi uCols body logicForest range ordts returnings applyDefaults)
|
||||
|
||||
Reference in New Issue
Block a user