@@ -142,7 +142,7 @@ unBinary (Binary x) = x
142instance Result SB.ByteString where
142instance Result SB.ByteString where
143 convert f dat = if typeOid f == builtin2oid Bytea
143 convert f dat = if typeOid f == builtin2oid Bytea
144 then unBinary <$> convert f dat
144 then unBinary <$> convert f dat
145− else doConvert f okText' pure dat
145+ else doConvert f okText' (pure . B.copy) dat
147instance Result PQ.Oid where
147instance Result PQ.Oid where
148 convert f dat = PQ.Oid <$> atto (mkCompat Oid) decimal f dat
148 convert f dat = PQ.Oid <$> atto (mkCompat Oid) decimal f dat
@@ -159,7 +159,7 @@ unescapeBytea f str = case unsafePerformIO (PQ.unescapeBytea str) of
159instance Result (Binary SB.ByteString) where
159instance Result (Binary SB.ByteString) where
160 convert f dat = case format f of
160 convert f dat = case format f of
161 PQ.Text -> doConvert f okBinary (unescapeBytea f) dat
161 PQ.Text -> doConvert f okBinary (unescapeBytea f) dat
162− PQ.Binary -> doConvert f okBinary (pure . Binary) dat
162+ PQ.Binary -> doConvert f okBinary (pure . Binary . B.copy) dat
164instance Result (Binary LB.ByteString) where
164instance Result (Binary LB.ByteString) where
165 convert f dat = Binary . LB.fromChunks . (:[]) . unBinary <$> convert f dat
165 convert f dat = Binary . LB.fromChunks . (:[]) . unBinary <$> convert f dat