Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown column 't3.i' in 'order clause' #20441

Closed
ChenPeng2013 opened this issue Oct 14, 2020 · 4 comments · Fixed by #20977
Closed

Unknown column 't3.i' in 'order clause' #20441

ChenPeng2013 opened this issue Oct 14, 2020 · 4 comments · Fixed by #20977
Assignees
Labels
severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@ChenPeng2013
Copy link
Contributor

ChenPeng2013 commented Oct 14, 2020

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

DROP TABLE if exists t1, t2, t3;
create table t1 (i int);
create table t2 (i int);
create table t3 (i int);
select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;

2. What did you expect to see? (Required)

mysql> select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
Empty set (0.00 sec)
mysql> select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
Empty set (0.01 sec)
mysql> select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
Empty set (0.00 sec)
mysql> select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
Empty set (0.01 sec)

3. What did you see instead (Required)

mysql> select * from t1,t2 natural left join t3 order by t1.i,t2.i,t3.i;
ERROR 1054 (42S22): Unknown column 't3.i' in 'order clause'
mysql> select t1.i,t2.i,t3.i from t2 natural left join t3,t1 order by t1.i,t2.i,t3.i;
ERROR 1054 (42S22): Unknown column 't3.i' in 'order clause'
mysql> select * from t1,t2 natural right join t3 order by t1.i,t2.i,t3.i;
ERROR 1054 (42S22): Unknown column 't2.i' in 'order clause'
mysql> select t1.i,t2.i,t3.i from t2 natural right join t3,t1 order by t1.i,t2.i,t3.i;
ERROR 1054 (42S22): Unknown column 't2.i' in 'order clause'

4. What is your TiDB version? (Required)

master a17d3a9 and release-4.0 8c6879c

@ChenPeng2013 ChenPeng2013 added the type/bug The issue is confirmed as a bug. label Oct 14, 2020
@francis0407
Copy link
Member

Looks similar to #15844

@francis0407
Copy link
Member

/label sig/planner

@ti-srebot ti-srebot added the sig/planner SIG: Planner label Oct 14, 2020
@lzmhhh123
Copy link
Contributor

/assign

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment