Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nix/overlays/haskell-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ let

hspec-wai-json =
lib.dontCheck (lib.unmarkBroken prev.hspec-wai-json);

hasql =
lib.dontCheck (prev.callCabal2nixWithOptions "hasql"
(super.fetchFromGitHub {
owner = "robx";
repo = "hasql";
rev = "433428a6c9df2be000e86e06af2f16076395582e";
sha256 = "sha256-tw+0d6EcHpcKoHXK9wqjRBlAZFmbeDPWXIgOJWGQ5ag=";
}) ""
{ });

} // extraOverrides final prev;
in
{
Expand Down
4 changes: 2 additions & 2 deletions src/PostgREST/Query/SqlFragment.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ normalizedBody body =
"END AS val",
"FROM pgrst_payload)"])
where
jsonPlaceHolder = SQL.encoderAndParam (HE.nullable HE.unknown) (LBS.toStrict <$> body) <> "::json"
jsonPlaceHolder = SQL.encoderAndParam (HE.nullable HE.unknownLazy) body <> "::json"

singleParameter :: Maybe LBS.ByteString -> ByteString -> SQL.Snippet
singleParameter body typ =
if typ == "bytea"
-- TODO: Hasql fails when using HE.unknown with bytea(pg tries to utf8 encode).
then SQL.encoderAndParam (HE.nullable HE.bytea) (LBS.toStrict <$> body)
else SQL.encoderAndParam (HE.nullable HE.unknown) (LBS.toStrict <$> body) <> "::" <> SQL.sql typ
else SQL.encoderAndParam (HE.nullable HE.unknownLazy) body <> "::" <> SQL.sql typ

selectBody :: SqlFragment
selectBody = "(SELECT val FROM pgrst_body)"
Expand Down