-
Notifications
You must be signed in to change notification settings - Fork 404
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
RuntimeError: no encoder for OID 1000 #122
Comments
Do you mind sharing the actual query and the table structure on which this can be reproduced? This works for me: res = await self.con.fetchval('''
SELECT $1::bool[][]
''', [[True, False], [False, True]]) |
The issue occurs under different conditions than I originally thought. It is not caused by nested arrays, but under some scenarios where I'm working with both array and geom types. I've pasted-in an example scenario below that triggers the issue on my system:
This will replicate the issue for me (requires PostGIS extension): import asyncio
import asyncpg
async def array_vs_geom():
db_connection = await asyncpg.connect(
host='localhost',
port=5432,
user='my_username'
)
await db_connection.execute('''
CREATE SCHEMA IF NOT EXISTS my_schema;
CREATE TABLE IF NOT EXISTS my_schema.my_table (
id text PRIMARY KEY,
arr boolean[2],
geom geometry(Point, 4326)
);
CREATE UNIQUE INDEX IF NOT EXISTS id_index_test ON my_schema.my_table (id);
''')
for i in range(50000):
if i % 1000 == 0:
print(f'Processed {i}')
try:
await db_connection.execute(f'''
INSERT INTO my_schema.my_table (id, arr, geom)
VALUES ($1, $2, ST_SetSRID($3::geometry, 4326))
ON CONFLICT (id) DO UPDATE SET
arr = $2,
geom = ST_SetSRID($3::geometry, 4326)
WHERE my_schema.my_table.id = $1
''',
i,
# happens regardless of specific array contents or dimensions
[True, True],
# happens regardless of specific geometry
'01010000000C71568BA2F15BC01B419A196CB04040')
except Exception as e:
# error encountered at 25,000 items for pool, or immediately if no pool
print(f' exception {e} at count {i}')
raise e
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(array_vs_geom()) |
Confirmed. I can reproduce this with your script. |
Fixed in df64f55. |
After inserting around 25,000 items into a database, I'll start getting this error:
which I've isolated to a boolean array data type (boolean[7][24]). (The error doesn't occur when I don't set this value).
It is a nested list of 7*24 elements, which is converted from a numpy array to a python list via the numpy
to_list()
method.The
asyncpg
version is 0.10.1The text was updated successfully, but these errors were encountered: