git.iko.soy/typeable/postgresql-simple
on master help sign in
Tweak CopyOut handling
a14930dLeon P Smith
src/Database/PostgreSQL/Simple/Copy.hs+2−2
@@ -84,9 +84,9 @@ getCopyData conn = withConnection conn loop
84 result <- maybe (fail errCmdStatus) return =<< PQ.getResult pqconn
84 result <- maybe (fail errCmdStatus) return =<< PQ.getResult pqconn
85 cmdStat <- maybe (fail errCmdStatus) return =<< PQ.cmdStatus result
85 cmdStat <- maybe (fail errCmdStatus) return =<< PQ.cmdStatus result
86 let rowCount = P.string "COPY " *> P.decimal
86 let rowCount = P.string "COPY " *> P.decimal
87− case P.parseOnly rowCount cmdStat of
87+ case P.parseOnly (rowCount <* P.endOfInput) cmdStat of
88 Left _ -> fail errCmdStatusFmt
88 Left _ -> fail errCmdStatusFmt
89− Right n -> return (CopyOutDone n)
89+ Right n -> return $! CopyOutDone n
90#if defined(mingw32_HOST_OS)
90#if defined(mingw32_HOST_OS)
91 PQ.CopyOutWouldBlock -> do
91 PQ.CopyOutWouldBlock -> do
92 fail (B.unpack funcName ++ ": the impossible happened")
92 fail (B.unpack funcName ++ ": the impossible happened")