dolthub / dolthub/dolt

Alias selection and conflated results when the same alias name is projected multiple times before a subquery

Open
#4,537 1 comment 0 reactions 1 assignee Claimed by @zachmu View on GitHub
analyzer bug
Dominant language
Go
Stars
24.4k
Forks
873
Avg merge
1d 8h
Merged PRs (30d)
120

Description

When projection expressions define multiple aliases with the same name and project a subquery using that alias name, we don't match MySQL's behavior.

**Example Query:** `select 0 as a, 1 as a, (SELECT x from xy where x = a);`
**MySQL Results:** `{0, 1, 0}`
**GMS Results:** `{1, 1, 1}`

GMS currently chooses the second alias when it is referenced in the subquery, and the first column gets conflated with the second alias and returns incorrect results, too. This bug doesn't happen without the subquery projection expression, so seems likely that as part of manipulating the plan, we mess up the projection expressions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.