diff --git a/hasql-cursor-query.cabal b/hasql-cursor-query.cabal
--- a/hasql-cursor-query.cabal
+++ b/hasql-cursor-query.cabal
@@ -1,7 +1,7 @@
 name:
   hasql-cursor-query
 version:
-  0.4
+  0.4.1
 category:
   Hasql, Database, PostgreSQL, Streaming
 synopsis:
@@ -57,7 +57,7 @@
     -- database:
     hasql >= 0.19 && < 0.20,
     hasql-transaction >= 0.4.5.1 && < 0.5,
-    hasql-cursor-transaction >= 0.5 && < 0.6,
+    hasql-cursor-transaction >= 0.6 && < 0.7,
     -- data:
     bytestring >= 0.10 && < 0.11,
     -- control:
diff --git a/library/Hasql/CursorQuery/Private/CursorTransactions.hs b/library/Hasql/CursorQuery/Private/CursorTransactions.hs
--- a/library/Hasql/CursorQuery/Private/CursorTransactions.hs
+++ b/library/Hasql/CursorQuery/Private/CursorTransactions.hs
@@ -38,6 +38,6 @@
 -- Executes CursorQuery in CursorTransaction provided the parameters.
 cursorQuery :: params -> B.CursorQuery params result -> G.CursorTransaction s result
 cursorQuery params (B.CursorQuery template encoder (B.ReducingDecoder rowDecoder rowsFold) batchSize) =
-  G.withCursor template (G.encodedParams encoder params) $
-  \ cursor ->
+  do
+    cursor <- G.declareCursor template (G.encodedParams encoder params)
     fetchAndFoldCursor cursor batchSize rowDecoder rowsFold
