8000 Tests connection remains valid after PostgresError · postgres-haskell/postgres-wire@2072ede · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2072ede

Browse files
Tests connection remains valid after PostgresError
1 parent 2205b17 commit 2072ede

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/Driver.hs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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.
159176
testDescribeStatement :: IO ()
160177
testDescribeStatement = withConnectionCommon $ \c -> do

0 commit comments

Comments
 (0)
0