@@ -166,17 +166,6 @@ class FromField a where
166166 -- Returns a list of exceptions if the conversion fails. In the case of
167167 -- library instances, this will usually be a single 'ResultError', but
168168 -- may be a 'UnicodeException'.
169− --
170− -- Note that retaining any reference to the 'Field' or 'ByteString'
171− -- arguments causes the entire @LibPQ.'PQ.Result'@ to be retained.
172− -- Thus, as a rule of thumb, implementations of 'fromField' should
173− -- not refer to these values after the result has been evaluated
174− -- to WHNF. But it can be profitable to break this rule when you
175− -- know it won't cause memory management problems.
176− --
177− -- The instances included with postgresql-simple follow this rule
178− -- of thumb (modulo bugs). For example, the instance for 'ByteString'
179− -- uses 'B.copy' to avoid such a reference.
180169
181170-- | Returns the data type name. This is the preferred way of identifying
182171-- types that do not have a stable type oid, such as types provided by
@@ -320,7 +309,7 @@ unBinary (Binary x) = x
320309instance FromField SB.ByteString where
321310 fromField f dat = if typeOid f == $(inlineTypoid TI.bytea)
322311 then unBinary <$> fromField f dat
323− else doFromField f okText' (pure . B.copy) dat
312+ else doFromField f okText' pure dat
324313
325314-- | oid
326315instance FromField PQ.Oid where
@@ -340,7 +329,7 @@ unescapeBytea f str = case unsafeDupablePerformIO (PQ.unescapeBytea str) of
340329instance FromField (Binary SB.ByteString) where
341330 fromField f dat = case format f of
342331 PQ.Text -> doFromField f okBinary (unescapeBytea f) dat
343− PQ.Binary -> doFromField f okBinary (pure . Binary . B.copy) dat
332+ PQ.Binary -> doFromField f okBinary (pure . Binary) dat
344333
345334-- | bytea
346335instance FromField (Binary LB.ByteString) where