psqlpy-python / psqlpy

Asynchronous Python PostgreSQL driver written in Rust
https://psqlpy-python.github.io/
MIT License
211 stars 3 forks source link

psqlpy.exceptions.RustToPyValueMappingError: array contains too many dimensions #79

Closed nicolaspi closed 5 days ago

nicolaspi commented 1 month ago

psqlpy-0.7.6 The following code raises: psqlpy.exceptions.RustToPyValueMappingError: Can't convert value from driver to python type: Cannot convert PostgreSQL type _int4 into Python type, err: array contains too many dimensions (the query executes properly in PSQL)

import asyncio
from psqlpy import ConnectionPool

def main():
    db_pool = ConnectionPool()
    result = asyncio.run(db_pool.execute(
        "SELECT array_agg(arr) FROM (SELECT array(SELECT generate_series(0, 10, 1)) as arr FROM (SELECT generate_series(0, 10, 1) as value));",
    ))
    result.result()
    db_pool.close()

main()
chandr-andr commented 1 month ago

Hello! Thank you for your issue. I've found out that there is really a bug, and I'll fix it as soon as possible.

Thank you!

chandr-andr commented 3 weeks ago

@nicolaspi Hello! I've made a new release https://github.com/psqlpy-python/psqlpy/releases/tag/0.7.7 with support for multi-dimensional arrays. Please check it out)