Skip to content

ValueError: cannot override codec when using set_builtin_type_codec with connection pool #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dgelvin opened this issue Feb 22, 2017 · 1 comment

Comments

@dgelvin
Copy link

dgelvin commented Feb 22, 2017

  • 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.

@1st1
Copy link
Member

1st1 commented Mar 3, 2017

Fixed in v0.9.0. Use new init parameter to create_pool.

@1st1 1st1 closed this as completed Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants