1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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

This commit is contained in:
unknown
2003-04-08 15:55:28 +03:00
parent eaa27ad448
commit f4216c526b
3 changed files with 8 additions and 3 deletions

View File

@ -273,3 +273,5 @@ SELECT @a:=1 UNION SELECT @a:=@a+1;
@a:=1
1
2
(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);
Unknown column 'a' in 'field list'

View File

@ -146,3 +146,5 @@ drop table t1,t2;
(select 1) union (select 2) order by 0;
SELECT @a:=1 UNION SELECT @a:=@a+1;
--error 1054
(SELECT 1) UNION (SELECT 2) ORDER BY (SELECT a);

View File

@ -701,9 +701,10 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(last= sl)->get_table_list(), &where,
0)) != not_found_field)
break;
if ((refer= find_item_in_list(this, sl->item_list, &counter,
if (sl->item_list.elements &&
((refer= find_item_in_list(this, sl->item_list, &counter,
REPORT_EXCEPT_NOT_FOUND)) !=
(Item **)not_found_item)
(Item **)not_found_item))
break;
if (sl->master_unit()->first_select()->linkage ==
DERIVED_TABLE_TYPE)