Column alias might fail in the ORDER BY's subquery clause.
Open
severity/moderate
sig/planner
type/bug
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a INT, b INT);
CREATE TABLE t2 (a INT, b INT);
INSERT INTO t1 VALUES (1, 1);
INSERT INTO t2 VALUES (1, 1);
SELECT one.a, one.b as b2 FROM t1 one ORDER BY (SELECT two.b FROM t2 two WHERE two.a = b2);
```
### 2. What did you expect to see? (Required)
The query was executed successfully.
### 3. What did you see instead (Required)
Error reported that column `b2` in the ORDER BY clause is not found.
### 4. What is your TiDB version? (Required)
current master
Contributor guide
Assessment
This issue has not been assessed yet.