Skip to content

fix(postgres): allow pool reset for unmanaged upstreams - #279

Closed
nhurwitz wants to merge 1 commit into
paradigmxyz:mainfrom
alumina-ai:fix/postgres-unmanaged-pool-reset
Closed

nhurwitz wants to merge 1 commit into
paradigmxyz:mainfrom
alumina-ai:fix/postgres-unmanaged-pool-reset

Conversation

@nhurwitz

Copy link
Copy Markdown

An asyncpg pool using an upstream with no configured role or settings can commit a query and then fail on release: its default cleanup includes RESET ALL, which the proxy rejects unconditionally.

Allow standalone RESET ALL only when the upstream has neither an injected role nor pinned settings. Preserve rejection inside other statements (including routines and ALTER), for managed connections, and for all existing role changes, set_config calls and DISCARD ALL. Apply the same policy to Simple Query and Extended Query Parse messages. No new configuration or dependencies.

Validation:

  • go test -race -count=1 ./..., go vet ./..., and go build ./... passed. The opt-in integration suite was skipped.
  • Reproduced against PostgreSQL 16.10 and asyncpg 0.30.0 with original and patched binaries: before, a committed INSERT was followed by a release error; after, release and reuse of the same backend succeeded and session settings were reset.
  • Verified both query protocols still reject resets for role-only, settings-only and combined configurations, preserving their role/settings. Added policy and relay regression tests, including routine definitions, ALTER forms and mixed batches.

@nhurwitz nhurwitz closed this Oct 12, 2026
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.

1 participant