asyncpg
asyncpg copied to clipboard
ValueError: cannot override codec when using set_builtin_type_codec with connection pool
- asyncpg version: 0.8.4
- PostgreSQL version: 9.6.0
- Python version: 3.5.1
- Platform: Linux
- Do you use pgbouncer?: No
- Do you use the wheel package or built locally (if locally, which version of Cython was used)?: Wheel package
- Can you the issue be reproduced when running under uvloop?:
I have the following coroutine for setting up hstore support:
async def setup_connection(connection):
await connection.execute('CREATE EXTENSION IF NOT EXISTS hstore')
await connection.set_builtin_type_codec('hstore', codec_name='pg_contrib.hstore')
I am creating a connection pool with:
pool = await asyncpg.create_pool(setup=setup_connection, loop=loop)
Everything works at first, but after an indeterminate number of async with pool.acquire() as connection: calls I eventually get the following exception:
ValueError: cannot override codec for type 1419710
Is there another way I should be enabling hstore support with a connection pool?
Thanks for the great library.
Fixed in v0.9.0. Use new init parameter to create_pool.