help wantedpriority/P4sig/executionsig/plannertype/compatibility
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
- What did you do?
select * union select 1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
create table t2 (a int);
insert into t2 values (3),(4),(5);
select a from t1 union select a from t2 order by t2.a;
- What did you expect to see?
mysql> select * union select 1;
ERROR 1096 (HY000): No tables used
mysql> select a from t1 union select a from t2 order by t2.a;
ERROR 1250 (42000): Table 't2' from one of the SELECTs cannot be used in field list
- What did you see instead?
tidb> select * union select 1;
ERROR 1051 (42S02): Unknown table ''
tidb> select a from t1 union select a from t2 order by t2.a;
ERROR 1054 (42S22): Unknown column 't2.a' in 'order clause'
- What version of TiDB are you using (
tidb-server -Vor runselect tidb_version();on TiDB)?
tidb> select tidb_version();
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v2.1.0-rc.3-158-g1082d5f1a
Git Commit Hash: 1082d5f1ac90c7d73b34061ccef7c5cae1b69b6c
Git Branch: master
UTC Build Time: 2018-11-08 07:01:33
GoVersion: go version go1.11 darwin/amd64
Race Enabled: false
TiKV Min Version: 2.1.0-alpha.1-ff3dd160846b7d1aed9079c389fc188f7f5ea13e
Check Table Before Drop: false |
+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)