MagicStack / MagicStack/asyncpg

Temporary tables still visible after releasing connection to pool

Offen
#1,293 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
8.1k
Forks
468
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

It seems like releasing a connection back to the pool doesn't entirely reset its state in a way that makes it brand new for the next user. Is it expected that temporary tables are still visible? Temporary tables in PostgreSQL are dropped after the session exits but wondering if there is a missing incantation in `Connection.reset()` that will allow it to be reused.

```python
import asyncio

import asyncpg

async def main():
pool = await asyncpg.create_pool(
...
min_size=1,
max_size=1,
)

async with pool.acquire() as conn:
await conn.execute("CREATE TEMPORARY TABLE foo(id INT PRIMARY KEY)")

async with pool.acquire() as conn:
await conn.execute("CREATE TEMPORARY TABLE foo(id INT PRIMARY KEY)") # DuplicateTableException

asyncio.run(main())

```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Start by running the supplied asyncio reproduction with a one-connection pool, then inspect Connection.reset() and the pool acquire/release path. Determine whether releasing a connection should remove the temporary table, and make the behavior match the documented pool-reset expectations, with the reproduction serving as the completion check.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
postgresql, python
Bereich
databases
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.