cockroachdb / cockroachdb/cockroach

Unexpected nesting level when using ROW(t.*) syntax

Open
#148,990 2 comments 0 reactions 0 assignees View on GitHub
A-sql-pgcompat C-bug O-community T-sql-queries X-blathers-triaged
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Describe the problem**

When using the `ROW(t.*)` syntax, the resulting `ROW` value is nested one level too many in my opinion, especially when comparing to PostgreSQL.

**To Reproduce**

```sql
select row(t.*)::text
from (select 1, 2) as t (u, v);
```

This produces:

```
|row |
|---------|
|("(1,2)")|
```

I.e. the same thing as:

```sql
select row(row(1, 2))::text
```

**Expected behavior**

I'd expect the same thing as in PostgreSQL, which flattens the nested tuple, producing:

```
|row |
|-----|
|(1,2)|
```

I.e. the same thing as:

```sql
select row(1, 2)::text
```

The underlying root cause might be the same one as here, not sure:

- https://github.com/cockroachdb/cockroach/issues/83892

**Environment:**

- CockroachDB version: CockroachDB CCL v25.2.1 (x86_64-pc-linux-gnu, built 2025/06/02 23:17:23, go1.23.7 X:nocoverageredesign)
- Server OS: Linux on Docker on Windows
- Client app: JDBC

Jira issue: CRDB-51916

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.