File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ testDriver = testGroup "Driver"
3434 , testCase " Empty query" testEmptyQuery
3535 , testCase " Query without result" testQueryWithoutResult
3636 , testCase " Invalid queries" testInvalidBatch
37+ , testCase " Valid after postgres error" testValidAfterError
3738 , testCase " Describe statement" testDescribeStatement
3839 , testCase " Describe statement with no data" testDescribeStatementNoData
3940 , testCase " Describe empty statement" testDescribeStatementEmpty
@@ -155,6 +156,22 @@ testInvalidBatch = do
155156 sendBatchAndSync c qs
156157 checkInvalidResult c $ length qs
157158
159+ -- | Connection remains valid even after PostgreSQL returned error on the
160+ -- previous query.
161+ testValidAfterError :: IO ()
162+ testValidAfterError = withConnection $ \ c -> do
163+ let a = " 5"
164+ rightQuery = makeQuery1 a
165+ invalidQuery = Query " SELECT $1" (V. fromList [] ) Text Text NeverCache
166+ sendBatchAndSync c [invalidQuery]
167+ checkInvalidResult c 1
168+ waitReadyForQuery c
169+
170+ sendBatchAndSync c [rightQuery]
171+ r <- readNextData c
172+ waitReadyForQuery c
173+ a @=? fromMessage r
174+
158175-- | Describes usual statement.
159176testDescribeStatement :: IO ()
160177testDescribeStatement = withConnectionCommon $ \ c -> do
You can’t perform that action at this time.
0 commit comments