GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Drop temporary tables when resetting a pooled connection by vsaraikin · Pull Request #1392 · MagicStack/asyncpg

Conversation

@vsaraikin

@vsaraikin vsaraikin commented Oct 14, 2026

Copy link
Copy Markdown

Fixes #1293

The default reset query doesn't drop temporary tables, so a temp table created by one acquirer is still there for the next one, data included. A second CREATE TEMPORARY TABLE with the same name fails with DuplicateTableError, and a table with leftover rows can be read by whatever code gets the connection next. The pool docs say the reset should leave the connection in a well-defined state, and the rest of the reset query already clears cursors, listeners, settings and advisory locks.

This adds DISCARD TEMP to the reset query. DISCARD ALL would also deallocate prepared statements and break the statement cache, DISCARD TEMP only drops the temp tables. It is gated on a new sql_discard_temp capability that is set for standard PostgreSQL and off for Redshift, CockroachDB and CrateDB. The field defaults to False, so code that builds ServerCapabilities itself by keyword (guillotina does this to turn the reset off) keeps working and keeps its current reset query.

test_pool_release_drops_temp_tables fails on master and passes with the change. The rest of tests/ gives the same result as master against PostgreSQL 17, and flake8 passes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vsaraikin
Drop temporary tables when resetting a pooled connection
6c50263
@KevinBlakeLopez KevinBlakeLopez mentioned this pull request Oct 27, 2026
SET ROLE survives the default pool reset #1402
Open
@vsaraikin

vsaraikin commented Nov 5, 2026

Copy link
Copy Markdown
Author

@elprans could you approve the CI run and take a look when you have time?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This branch has not been deployed

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Temporary tables still visible after releasing connection to pool

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@vsaraikin
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.