git.iko.soy/typeable/postgresql-simple
on master help sign in
Add missing patterns
commitd8f6d7d762f74f29bc5a590d915724993fe51e9e authorBardur Arantsson <bardur@scientician.net> dateSat 22 Apr 2017, 06:12 (9 years ago) parent3913d56
2 files changed+9−2
src/Database/PostgreSQL/Simple/Copy.hs+5−2 src/Database/PostgreSQL/Simple/Internal/PQResultUtils.hs+4
src/Database/PostgreSQL/Simple/Copy.hs+5−2
@@ -75,15 +75,18 @@ doCopy :: B.ByteString -> Connection -> Query -> B.ByteString -> IO ()
7575doCopy funcName conn template q = do
7676 result <- exec conn q
7777 status <- PQ.resultStatus result
78− let err = throwIO $ QueryError
79− (B.unpack funcName ++ " " ++ show status)
78+ let errMsg msg = throwIO $ QueryError
79+ (B.unpack funcName ++ " " ++ msg)
8080 template
81+ let err = errMsg $ show status
8182 case status of
8283 PQ.EmptyQuery -> err
8384 PQ.CommandOk -> err
8485 PQ.TuplesOk -> err
8586 PQ.CopyOut -> return ()
8687 PQ.CopyIn -> return ()
88+ PQ.CopyBoth -> errMsg "COPY BOTH is not supported"
89+ PQ.SingleTuple -> errMsg "single-row mode is not supported"
8790 PQ.BadResponse -> throwResultError funcName result status
8891 PQ.NonfatalError -> throwResultError funcName result status
8992 PQ.FatalError -> throwResultError funcName result status
src/Database/PostgreSQL/Simple/Internal/PQResultUtils.hs+4
@@ -45,6 +45,10 @@ finishQueryWith parser conn q result = do
4545 throwIO $ QueryError "query: COPY TO is not supported" q
4646 PQ.CopyIn ->
4747 throwIO $ QueryError "query: COPY FROM is not supported" q
48+ PQ.CopyBoth ->
49+ throwIO $ QueryError "query: COPY BOTH is not supported" q
50+ PQ.SingleTuple ->
51+ throwIO $ QueryError "query: single-row mode is not supported" q
4852 PQ.BadResponse -> throwResultError "query" result status
4953 PQ.NonfatalError -> throwResultError "query" result status
5054 PQ.FatalError -> throwResultError "query" result status