dolthub / dolthub/doltgresql

Support multidimensional PostgreSQL arrays

Open
#3,183 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.1k
Forks
73
Avg merge
1d 10h
Merged PRs (30d)
129

Description

DoltgreSQL supports one-dimensional arrays, but multidimensional array construction and storage are incomplete.

For example, PostgreSQL accepts:

```sql
SELECT ARRAY[ARRAY[1, 2], ARRAY[3, 4]];
SELECT array_to_json(ARRAY[ARRAY[1, 2], ARRAY[3, 4]]);
```

DoltgreSQL currently fails during evaluation with `cannot find cast function from integer[] to integer`. The outer constructor resolves to `integer[]`, then incorrectly attempts to cast each nested `integer[]` child to the scalar `integer` base type. Array serialization also notes that multidimensional values are not currently accounted for.

Acceptance criteria:

- Support nested `ARRAY[...]` constructors with PostgreSQL-compatible type resolution.
- Require matching dimensions for nested arrays and return PostgreSQL-compatible errors for ragged inputs.
- Preserve NULL elements and nested values.
- Round-trip multidimensional arrays through table storage and the PostgreSQL wire protocol.
- Support correct dimension and bound reporting.
- Verify subscripting, slicing, comparison, concatenation, and relevant array functions.
- Enable the skipped multidimensional `array_to_json` integration assertion.
- Validate all regression queries and expected results against a real PostgreSQL server.

Related umbrella issue: #3099

Contributor guide

Open the contributing guide

Research direction

Start with nested ARRAY[...] constructor evaluation and type resolution, then inspect the array serialization path and the skipped multidimensional array_to_json integration assertion. Compare the listed regression queries and expected results with a real PostgreSQL server, including storage and wire-protocol round trips. Done means matching dimensions, NULLs, bounds, subscripting, slicing, comparison, concatenation, and relevant array functions behave compatibly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.