git.iko.soy/typeable/postgresql-simple
on master help sign in
Add missing patterns
d8f6d7dBardur Arantsson
src/Database/PostgreSQL/Simple/Copy.hs+5−2
@@ -75,15 +75,18 @@ doCopy :: B.ByteString -> Connection -> Query -> B.ByteString -> IO ()
75doCopy funcName conn template q = do
75doCopy funcName conn template q = do
76 result <- exec conn q
76 result <- exec conn q
77 status <- PQ.resultStatus result
77 status <- PQ.resultStatus result
78− let err = throwIO $ QueryError
78+ let errMsg msg = throwIO $ QueryError
79− (B.unpack funcName ++ " " ++ show status)
79+ (B.unpack funcName ++ " " ++ msg)
80 template
80 template
81+ let err = errMsg $ show status
81 case status of
82 case status of
82 PQ.EmptyQuery -> err
83 PQ.EmptyQuery -> err
83 PQ.CommandOk -> err
84 PQ.CommandOk -> err
84 PQ.TuplesOk -> err
85 PQ.TuplesOk -> err
85 PQ.CopyOut -> return ()
86 PQ.CopyOut -> return ()
86 PQ.CopyIn -> return ()
87 PQ.CopyIn -> return ()
88+ PQ.CopyBoth -> errMsg "COPY BOTH is not supported"
89+ PQ.SingleTuple -> errMsg "single-row mode is not supported"
87 PQ.BadResponse -> throwResultError funcName result status
90 PQ.BadResponse -> throwResultError funcName result status
88 PQ.NonfatalError -> throwResultError funcName result status
91 PQ.NonfatalError -> throwResultError funcName result status
89 PQ.FatalError -> throwResultError funcName result status
92 PQ.FatalError -> throwResultError funcName result status
src/Database/PostgreSQL/Simple/Internal/PQResultUtils.hs+4
@@ -45,6 +45,10 @@ finishQueryWith parser conn q result = do
45 throwIO $ QueryError "query: COPY TO is not supported" q
45 throwIO $ QueryError "query: COPY TO is not supported" q
46 PQ.CopyIn ->
46 PQ.CopyIn ->
47 throwIO $ QueryError "query: COPY FROM is not supported" q
47 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
48 PQ.BadResponse -> throwResultError "query" result status
52 PQ.BadResponse -> throwResultError "query" result status
49 PQ.NonfatalError -> throwResultError "query" result status
53 PQ.NonfatalError -> throwResultError "query" result status
50 PQ.FatalError -> throwResultError "query" result status
54 PQ.FatalError -> throwResultError "query" result status