Skip to content

asyncpg.exceptions.DataError: invalid input for query argument $1 (value out of int32 range) #316

Closed
@eheien

Description

@eheien
  • asyncpg version: 0.16.0
  • PostgreSQL version: PostgreSQL 9.5.10 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-16), 64-bit (AWS RDS version)
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : Yes, AWS RDS
  • Python version: 3.6.4
  • Platform: Red Hat 4.8.5-16
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?: n/a
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : n/a

File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 372, in prepare
return await self._prepare(query, timeout=timeout, use_cache=False)
File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 377, in _prepare
use_cache=use_cache)
File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 308, in _get_statement
types_with_missing_codecs, timeout)
File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 348, in _introspect_types
self._intro_query, (list(typeoids),), 0, timeout)
File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 1363, in __execute
return await self._do_execute(query, executor, timeout)
File "/usr/lib64/python3.6/site-packages/asyncpg/connection.py", line 1385, in _do_execute
result = await executor(stmt, None)
File "asyncpg/protocol/protocol.pyx", line 190, in bind_execute
File "asyncpg/protocol/prepared_stmt.pyx", line 160, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
asyncpg.exceptions.DataError: invalid input for query argument $1: [4144356976] (value out of int32 range)

I'm encountering another issue similar to #279. When I use a custom data type defined in Postgres and attempt to reference it in a query, if the OID of the datatype is greater than 2^31 I get the above error. I'm not sure what the fix is, but I imagine it again involves treating OIDs as uint32 rather than int32 values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions