Исправление execute для пула

На текущий момент execute/fetch пула используют acquire/release. При этом это не является рекомендованным, так как влияет на prepared statement. Рекомендуется использовать контекст паттерн

Can be used either with an async with block:

async with asyncpg.create_pool(user='postgres',
                               command_timeout=60) as pool:
    await pool.fetch('SELECT 1')
Or to perform multiple operations on a single connection:

async with asyncpg.create_pool(user='postgres',
                               command_timeout=60) as pool:
    async with pool.acquire() as con:
        await con.execute('''
           CREATE TABLE names (
              id serial PRIMARY KEY,
              name VARCHAR (255) NOT NULL)
        ''')
        await con.fetch('SELECT 1')
Or directly with await (not recommended):

pool = await asyncpg.create_pool(user='postgres', command_timeout=60)
con = await pool.acquire()
try:
    await con.fetch('SELECT 1')
finally:
    await pool.release(con)

Warning:

Prepared statements and cursors returned by Connection.prepare() and Connection.cursor() become invalid once the connection is released. Likewise, all notification and log listeners are removed, and asyncpg will issue a warning if there are any listener callbacks registered on a connection that is being released to the pool.