@@ -224,7 +224,9 @@ getCopyCommandTag funcName pqconn = do
224224 consumeResults pqconn
225225 let rowCount = P.string "COPY " *> (P.decimal <* P.endOfInput)
226226 case P.parseOnly rowCount cmdStat of
227− Left _ -> fail errCmdStatusFmt
227+ Left _ -> do mmsg <- PQ.errorMessage pqconn
228+ fail $ errCmdStatusFmt
229+ ++ maybe "" (\msg -> "\nConnection error: "++B.unpack msg) mmsg
228230 Right n -> return $! n
229231 where
230232 errCmdStatus = B.unpack funcName ++ ": failed to fetch command status"