@@ -90,9 +90,16 @@ class FromField a where
9090 fromField :: Field -> Maybe ByteString -> Ok a
9191 -- ^ Convert a SQL value to a Haskell value.
9292 --
93− -- Returns an exception if the conversion fails. In the case of
94− -- library instances, this will usually be a 'ResultError', but may
95− -- be a 'UnicodeException'.
93+ -- Returns a list of exceptions if the conversion fails. In the case of
94+ -- library instances, this will usually be a single 'ResultError', but
95+ -- may be a 'UnicodeException'.
96+ --
97+ -- Implementations of the 'fromField' method should not retain any
98+ -- references to the ByteString it is passed, as this will cause the
99+ -- entire @LibPQ.'PQ.Result'@ to be retained. For example, the
100+ -- instance for 'ByteString' uses 'B.copy' to avoid this issue. Note that
101+ -- using bytestring functions such as 'B.drop' and 'B.takeWhile' alone
102+ -- will also trigger this memory leak.
96103
97104instance (FromField a) => FromField (Maybe a) where
98105 fromField _ Nothing = pure Nothing