apache / apache/arrow-adbc

adbc_driver_postgres flatten multi dimensional array in Postgres

Open
#2,063 3 comments 0 reactions 0 assignees View on GitHub
Type: bug
Dominant language
C#
Stars
627
Forks
217
Avg merge
17h
Merged PRs (30d)
57

Description

### What happened?

When querying a multi dimensional array in Postgres the returned result "loose" the dimensions, e. g. a 2 dimension array is returned as 1 dimension array, the query:

```SQL
select array[[1, 1], [2, 3]]
```

It should return:
```python
[([[1, 1],[2, 3]],)]
```

It returns:
```python
[([1, 1, 2, 3],)]
```

### Stack Trace

_No response_

### How can we reproduce the bug?

```python
import adbc_driver_postgresql.dbapi

conn_string = 'postgresql://postgres:XXXX@localhost:5432/postgres'
conn = adbc_driver_postgresql.dbapi.connect(conn_string)

cursor = conn.cursor()
query = 'select array[[1, 1], [2, 3]]'
cursor.execute(query)
cursor.fetchall()
```

### Environment/Setup

macOS
PostgreSQL 15
adbc-driver-postgresql 1.1.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue through adbc_driver_postgresql.dbapi.connect using the multidimensional PostgreSQL array query shown. Trace the PostgreSQL DBAPI result conversion and ensure the fetched value preserves nested array dimensions, then verify it matches the expected Python result.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.