cockroachdb / cockroachdb/cockroach

Multi-dimensional array expressions work but produce wrong results

Open
#146,717 1 comment 0 reactions 0 assignees View on GitHub
C-bug O-community T-sql-queries
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

There is claim that multi-dimensional arrays do not work yet:

- https://github.com/cockroachdb/cockroach/issues/32552
- https://www.cockroachlabs.com/docs/stable/functions-and-operators (several mentions of multi-dimensional arrays not being supported)

but they do when using some expressions, however, producing wrong results.

**To Reproduce**

Run:

```sql
select array[array['a']]::text
```

This produces

```
|array |
|-------|
|{"{a}"}|
```

**Expected behavior**

This should produce the following result, as in PostgreSQL:

```
|array|
|-----|
|{{a}}|
```

Or better (since multi-dimensional arrays aren't supported) raise an error.

**Environment:**
- CockroachDB version: CockroachDB CCL v25.1.6 (x86_64-pc-linux-gnu, built 2025/05/09 15:48:03, go1.22.8 X:nocoverageredesign)
- Client app: JDBC

Jira issue: CRDB-50673

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.