mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Proper handling of ORDER BY table.column in UNION's
This commit is contained in:
@ -85,10 +85,7 @@ a b
|
||||
2 b
|
||||
1 a
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
|
||||
a b
|
||||
1 a
|
||||
2 b
|
||||
3 c
|
||||
Table 't1' from one of SELECT's can not be used in order clause
|
||||
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
|
||||
|
@ -20,6 +20,7 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 4;
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1);
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
|
||||
--error 1248
|
||||
(select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by t1.b;
|
||||
explain (select a,b from t1 limit 2) union all (select a,b from t2 order by a limit 1) order by b desc;
|
||||
#(select sql_calc_found_rows a,b from t1 limit 2) union all (select a,b from t2 order by a) limit 2;
|
||||
|
Reference in New Issue
Block a user