diff options
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index f5488f59adf..cb385b482cf 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -112,6 +112,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, SELECT_LEX *lex_select_save= thd_arg->lex->current_select; SELECT_LEX *sl, *first_select; select_result *tmp_result; + ORDER *tmp_order; DBUG_ENTER("st_select_lex_unit::prepare"); /* @@ -207,6 +208,19 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, } } + for (tmp_order= (ORDER*) global_parameters->order_list.first; + tmp_order ; + tmp_order= tmp_order->next; + { + Item *item= *tmp_order->item; + if (((item->type() == Item::FIELD_ITEM) && + ((class Item_field*) item)->table_name)) + { + my_error(ER_BAD_FIELD_ERROR,MYF(0),item->full_name(),"ORDER BY"); + DBUG_RETURN(-1); + } + } + item_list.empty(); // it is not single select if (first_select->next_select()) |