Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenceisla committed Aug 11, 2022
1 parent 3affe7c commit 506df5a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/PostgREST/Query/QueryBuilder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ mutateRequestToQuery (Update mainQi uCols body logicForest pkFlts range ordts re
pkInCols = S.fromList pkFlts `S.isSubsetOf` uCols
logicForestF = intercalateSnippet " AND " (pgFmtLogicTree mainQi <$> logicForest)
pgrstUpdateBodyF = SQL.sql (BS.intercalate " AND " $ (\x -> pgFmtColumn mainQi x <> " = " <> pgFmtColumn (QualifiedIdentifier mempty "pgrst_update_body") x) <$> pkFlts)
logicForestAndDelBodyF = intercalateSnippet " AND " ([logicForestF | not (null logicForest)] ++ [pgrstDeleteBodyF | not hasEmptyBody])
emptyBodyReturnedColumns = if null returnings then "NULL" else BS.intercalate ", " (pgFmtColumn (QualifiedIdentifier mempty $ qiName mainQi) <$> returnings)
nonRangeCols = BS.intercalate ", " (pgFmtIdent <> const " = pgrst_update_body." <> pgFmtIdent <$> S.toList uCols)
rangeCols = BS.intercalate ", " ((\col -> pgFmtIdent col <> " = (SELECT " <> pgFmtIdent col <> " FROM pgrst_update_body) ") <$> S.toList uCols)
Expand Down
2 changes: 1 addition & 1 deletion test/spec/Feature/Query/QueryLimitedSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec =
{ "id": 8, "name": "HaikuOS" } ]|]
{ matchStatus = 201 }

it "doesn't affect updates" $
it "doesn't affect updates(2 rows would be modified if it did)" $
request methodPatch "/employees?select=first_name,last_name,occupation"
[("Prefer", "return=representation")]
[json| [{"occupation": "Barista"}] |]
Expand Down

0 comments on commit 506df5a

Please sign in to comment.