Skip to content

Fix prepared cursors with statement cache disabled - #1345

Draft
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1335-preserve-explicit-prepares
Draft

Fix prepared cursors with statement cache disabled#1345
aryansk wants to merge 1 commit into
MagicStack:masterfrom
aryansk:fix/1335-preserve-explicit-prepares

Conversation

@aryansk

@aryansk aryansk commented Aug 16, 2026

Copy link
Copy Markdown

Summary

Restore the documented auto-generated-name behavior for explicit Connection.prepare() calls when statement_cache_size=0. This prevents internal type-introspection queries from replacing the user's unnamed statement before a cursor can bind it.

Changes

  • make an omitted explicit prepare name request a unique generated statement name regardless of cache settings
  • keep internal execution/cache behavior unchanged
  • add a focused unit regression around _prepare() naming with the statement cache disabled

Validation

Adds focused coverage in tests/test_prepare_naming.py. Full asyncpg tests should run in CI.

Fixes #1335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant