@@ -235,7 +235,6 @@ finishExecute :: Connection -> Query -> PQ.Result -> IO Int64
235235finishExecute conn q result = do
236236 status <- PQ.resultStatus result
237237 case status of
238− PQ.EmptyQuery -> fail "empty query" -- FIXME: error message
239238 PQ.CommandOk -> do
240239 ncols <- PQ.nfields result
241240 if ncols /= 0
@@ -256,10 +255,10 @@ finishExecute conn q result = do
256255 errormsg <- maybe "" id <$> PQ.resultErrorMessage result
257256 statusmsg <- PQ.resStatus status
258257 state <- maybe "" id <$> PQ.resultErrorField result PQ.DiagSqlstate
259− throw $ SqlError { sqlState = state
260− , sqlNativeError = 0 -- FIXME
261− , sqlErrorMsg = B.concat [ "execute: ", statusmsg
262− , ": ", errormsg ]}
258+ throwIO $ SqlError { sqlState = state
259+ , sqlNativeError = fromEnum status
260+ , sqlErrorMsg = B.concat [ "execute: ", statusmsg
261+ , ": ", errormsg ]}
263262 where
264263 toInteger str = B.foldl' delta 0 str
265264 where
@@ -377,7 +376,6 @@ finishQuery :: (QueryResults r) => Connection -> Query -> PQ.Result -> IO [r]
377376finishQuery conn q result = do
378377 status <- PQ.resultStatus result
379378 case status of
380− PQ.EmptyQuery -> fail "empty query" -- FIXME: error message
381379 PQ.CommandOk -> do
382380 throwIO $ QueryError "query resulted in a command response" q
383381 PQ.TuplesOk -> do
@@ -398,10 +396,10 @@ finishQuery conn q result = do
398396 errormsg <- maybe "" id <$> PQ.resultErrorMessage result
399397 statusmsg <- PQ.resStatus status
400398 state <- maybe "" id <$> PQ.resultErrorField result PQ.DiagSqlstate
401− throw $ SqlError { sqlState = state
402− , sqlNativeError = 0 -- FIXME
403− , sqlErrorMsg = B.concat [ "execute: ", statusmsg
404− , ": ", errormsg ]}
399+ throwIO $ SqlError { sqlState = state
400+ , sqlNativeError = fromEnum status
401+ , sqlErrorMsg = B.concat [ "query: ", statusmsg
402+ , ": ", errormsg ]}
405403
406404{--
407405withResult (Base.storeResult conn) q $ \r fs -> do
@@ -711,13 +709,13 @@ fmtError msg q xs = throw FormatError {
711709--
712710-- * For numeric types, any Haskell type that can accurately represent
713711-- all values of the given PostgreSQL type is considered \"compatible\".
714−-- For instance, you can always extract a PostgreSQL 16-bit @SMALLINT@
712+-- For instance, you can always extract a PostgreSQL 16-bit @SMALLINT@
715713-- column to a Haskell 'Int'. The Haskell 'Float' type can accurately
716714-- represent a @SMALLINT@, so it is considered compatble with those types.
717715--
718716-- * A numeric compatibility check is based only on the type of a
719717-- column, /not/ on its values. For instance, a PostgreSQL 64-bit
720−-- @BIGINT@ column will be considered incompatible with a Haskell
718+-- @BIGINT@ column will be considered incompatible with a Haskell
721719-- 'Int16', even if it contains the value @1@.
722720--
723721-- * If a numeric incompatibility is found, 'query' will throw a