Skip to content

python/c: postgresql handling of unknown types broken in 1.3? #2448

@lupko

Description

@lupko

What happened?

Hi,

There appears to be a regression in PostgreSQL driver between 1.3.0 and 1.2.0 when it comes to handling unknown types.

I have attached quick repro that queries pg catalog table with one of the unknown types.

Stack Trace

Traceback (most recent call last):
  File "...", line 17, in main
    cursor.execute("SELECT * FROM pg_type WHERE oid <= 6157")
  File ".../.venv/lib64/python3.12/site-packages/adbc_driver_manager/dbapi.py", line 698, in execute
    handle, self._rowcount = _blocking_call(
                             ^^^^^^^^^^^^^^^
  File "adbc_driver_manager/_lib.pyx", line 1573, in adbc_driver_manager._lib._blocking_call_impl
  File "adbc_driver_manager/_lib.pyx", line 1566, in adbc_driver_manager._lib._blocking_call_impl
  File "adbc_driver_manager/_lib.pyx", line 1217, in adbc_driver_manager._lib.AdbcStatement.execute_query
  File "adbc_driver_manager/_lib.pyx", line 260, in adbc_driver_manager._lib.check_error
adbc_driver_manager.NotSupportedError: NOT_IMPLEMENTED: [libpq] Column #32 ("typacl") has unknown type code 1034

How can we reproduce the bug?

from adbc_driver_postgresql import dbapi
import adbc_driver_manager.dbapi as adbc
import pyarrow

USERNAME = ""
PASSWORD = ""
HOST = "localhost"
PORT = 5432
DATABASE = ""

def main():
    c: adbc.Connection = dbapi.connect(
        f"postgresql://{USERNAME}:{PASSWORD}@{HOST}:{PORT}/{DATABASE}"
    )

    cursor = c.cursor()
    cursor.execute("SELECT * FROM pg_type WHERE oid <= 6157", ())
    print(cursor.fetch_arrow_table())


if __name__ == "__main__":
    main()

Environment/Setup

Python 3.12
adbc-driver-postgresql==1.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions