Skip to content

Commit d8f6d7d

Browse files
Add missing patterns
1 parent 3913d56 commit d8f6d7d

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/Database/PostgreSQL/Simple/Copy.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,18 @@ doCopy :: B.ByteString -> Connection -> Query -> B.ByteString -> IO ()
7575
doCopy 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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)