@@ -27,11 +27,11 @@ Note that the 'Float' and 'Double' instances use attoparsec's 'double'
27conversion routine, which sacrifices some accuracy for speed. If you
27conversion routine, which sacrifices some accuracy for speed. If you
28need accuracy, consider first converting data to a 'Scientific' or 'Rational'
28need accuracy, consider first converting data to a 'Scientific' or 'Rational'
29type, and then converting to a floating-point type. If you are defining
29type, and then converting to a floating-point type. If you are defining
30−your own 'Database.PostgreSQL.Simple.FromRow.FromRow' instances, this can be
30+your own 'Database.PostgreSQL.Simple.FromRow.FromRow' instances, this can be
31−acheived simply by
31+acheived simply by
32−@'fromRational' '<$>' 'Database.PostgreSQL.Simple.FromRow.field'@, although
32+@'fromRational' '<$>' 'Database.PostgreSQL.Simple.FromRow.field'@, although
33this idiom is additionally compatible with PostgreSQL's @numeric@ type.
33this idiom is additionally compatible with PostgreSQL's @numeric@ type.
34−If this is unacceptable, you may find
34+If this is unacceptable, you may find
35'Database.PostgreSQL.Simple.FromRow.fieldWith' useful.
35'Database.PostgreSQL.Simple.FromRow.fieldWith' useful.
37Because 'FromField' is a typeclass, one may provide conversions to
37Because 'FromField' is a typeclass, one may provide conversions to
@@ -104,12 +104,11 @@ module Database.PostgreSQL.Simple.FromField
105#include "MachDeps.h"
105#include "MachDeps.h"
107−import Control.Applicative
107+import Control.Applicative ( (<|>), (<$>), pure )
108− ( Applicative, (<|>), (<$>), pure )
109import Control.Concurrent.MVar (MVar, newMVar)
108import Control.Concurrent.MVar (MVar, newMVar)
110import Control.Exception (Exception)
109import Control.Exception (Exception)
111import qualified Data.Aeson as JSON
110import qualified Data.Aeson as JSON
112−import Data.Attoparsec.Char8 hiding (Result)
111+import Data.Attoparsec.ByteString.Char8 hiding (Result)
113import Data.ByteString (ByteString)
112import Data.ByteString (ByteString)
114import qualified Data.ByteString.Char8 as B
113import qualified Data.ByteString.Char8 as B
115import Data.Int (Int16, Int32, Int64)
114import Data.Int (Int16, Int32, Int64)
@@ -492,7 +491,7 @@ instance FromField UUID where
493instance FromField JSON.Value where
492instance FromField JSON.Value where
494 fromField f mbs =
493 fromField f mbs =
495− if typeOid f /= $(inlineTypoid TI.json)
494+ if typeOid f /= $(inlineTypoid TI.json) && typeOid f /= $(inlineTypoid TI.jsonb)
496 then returnError Incompatible f ""
495 then returnError Incompatible f ""
497 else case mbs of
496 else case mbs of
498 Nothing -> returnError UnexpectedNull f ""
497 Nothing -> returnError UnexpectedNull f ""