Commit f4216c52 authored by unknown's avatar unknown

Fix for a bug with empty item list in UNION's

parent eaa27ad4
...@@ -273,3 +273,5 @@ SELECT @a:=1 UNION SELECT @a:=@a+1; ...@@ -273,3 +273,5 @@ SELECT @a:=1 UNION SELECT @a:=@a+1;
@a:=1 @a:=1
1 1
2 2
(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
Unknown column 'a' in 'field list'
...@@ -146,3 +146,5 @@ drop table t1,t2; ...@@ -146,3 +146,5 @@ drop table t1,t2;
(select 1) union (select 2) order by 0; (select 1) union (select 2) order by 0;
SELECT @a:=1 UNION SELECT @a:=@a+1; SELECT @a:=1 UNION SELECT @a:=@a+1;
--error 1054
(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
...@@ -701,9 +701,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) ...@@ -701,9 +701,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(last= sl)->get_table_list(), &where, (last= sl)->get_table_list(), &where,
0)) != not_found_field) 0)) != not_found_field)
break; break;
if ((refer= find_item_in_list(this, sl->item_list, &counter, if (sl->item_list.elements &&
REPORT_EXCEPT_NOT_FOUND)) != ((refer= find_item_in_list(this, sl->item_list, &counter,
(Item **)not_found_item) REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item))
break; break;
if (sl->master_unit()->first_select()->linkage == if (sl->master_unit()->first_select()->linkage ==
DERIVED_TABLE_TYPE) DERIVED_TABLE_TYPE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment