cockroachdb / cockroachdb/cockroach
tuple constructor bug with `row` syntax
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Wrong row value creation when using `row` syntax, while plain `(...)` works as expected
**To Reproduce**
```sql
WITH user_api_keys AS (
SELECT 1 AS user_id, 101 AS user_api_key_id, 'abc123' AS api_key
), users AS (
SELECT 1 AS user_id, 'John Doe' AS name
)
SELECT user_api_keys.user_api_key_id, user_api_keys.user_id, row(users.*) AS user
FROM user_api_keys
LEFT JOIN users ON users.user_id = user_api_keys.user_id
WHERE user_api_keys.api_key = 'abc123';
user_api_key_id | user_id | user
------------------+---------+-----------------------
101 | 1 | ("(1,""John Doe"")")
```
while this is correct:
```sql
WITH user_api_keys AS (
SELECT 1 AS user_id, 101 AS user_api_key_id, 'abc123' AS api_key
), users AS (
SELECT 1 AS user_id, 'John Doe' AS name
)
SELECT user_api_keys.user_api_key_id, user_api_keys.user_id, (users.*) AS user
FROM user_api_keys
LEFT JOIN users ON users.user_id = user_api_keys.user_id
WHERE user_api_keys.api_key = 'abc123';
user_api_key_id | user_id | user
------------------+---------+-----------------
101 | 1 | (1,"John Doe")
```
**Environment:**
- CockroachDB version v22.1 Playground
Jira issue: CRDB-26506
Contributor guide
Research direction
Start by running the supplied SQL reproducer in the CockroachDB v22.1 Playground and compare row(users.*) with (users.*). No source file or test is named; locate the relevant tuple-construction entry point and add regression coverage showing that row(users.*) returns the same tuple values as the plain row syntax.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100