FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Allow cursors in externally managed transactions by aryansk · Pull Request #1350 · MagicStack/asyncpg · GitHub

Allow cursors in externally managed transactions - #1350

Draft
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1311-external-cursor-transaction
Draft

Allow cursors in externally managed transactions#1350
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1311-external-cursor-transaction

Conversation

aryansk commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Allow server-side cursors when the PostgreSQL connection is already inside a transaction started outside asyncpg's Transaction helper.

Changes

  • use the protocol-backed Connection.is_in_transaction() state instead of checking only _top_xact
  • preserve the existing error outside any transaction
  • add regression coverage for a transaction started with explicit BEGIN

Test plan

python -m unittest tests.test_cursor.TestCursor.test_cursor_external_transaction

Fixes #1311

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor cannot be used with externally-managed transaction

1 participant


Back | FazBrowse Home | New Git URL