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.
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())