Loading mysql-test/r/union.result +3 −0 Original line number Diff line number Diff line Loading @@ -56,3 +56,6 @@ t2 c 1 t2 d 1 t2 e 1 t2 f 1 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t2 ALL NULL NULL NULL NULL 4 mysql-test/t/union.test +0 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ select a,b from t1 union select a,b from t1; select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b; # Test some error conditions with UNION --error 1215 explain select a,b from t1 union all select a,b from t2; --error 1215 Loading sql/sql_select.cc +20 −17 Original line number Diff line number Diff line Loading @@ -6752,6 +6752,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, /* Don't log this into the slow query log */ join->thd->lex.select_lex.options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); if (join->thd->lex.select == &join->thd->lex.select_lex) { field_list.push_back(new Item_empty_string("table",NAME_LEN)); field_list.push_back(new Item_empty_string("type",10)); field_list.push_back(item=new Item_empty_string("possible_keys", Loading @@ -6767,8 +6769,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, field_list.push_back(new Item_real("rows",0.0,0,10)); field_list.push_back(new Item_empty_string("Extra",255)); if (send_fields(thd,field_list,1)) return; /* purecov: inspected */ return; } char buff[512],*buff_ptr; String tmp(buff,sizeof(buff)),*packet= &thd->packet; table_map used_tables=0; Loading Loading @@ -6899,6 +6901,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, // For next iteration used_tables|=table->map; } if (!join->thd->lex.select->next) send_eof(&thd->net); DBUG_VOID_RETURN; } Loading sql/sql_union.cc +19 −6 Original line number Diff line number Diff line Loading @@ -38,12 +38,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) uint elements; DBUG_ENTER("mysql_union"); if (lex->select_lex.options & SELECT_DESCRIBE) { my_error(ER_WRONG_USAGE,MYF(0),"DESCRIBE","UNION"); return -1; } /* Fix tables--to-be-unioned-from list to point at opened tables */ for (sl=&lex->select_lex; sl; sl=sl->next) { Loading @@ -66,6 +60,25 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) } } if (lex->select_lex.options & SELECT_DESCRIBE) { for (sl= &lex->select_lex; sl; sl=sl->next) { lex->select=sl; res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first, sl->item_list, sl->where, sl->ftfunc_list, (ORDER*) 0, (ORDER*) sl->group_list.first, sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK | SELECT_DESCRIBE, result); } return 0; } order = (ORDER *) last_sl->order_list.first; { Item *item; Loading Loading
mysql-test/r/union.result +3 −0 Original line number Diff line number Diff line Loading @@ -56,3 +56,6 @@ t2 c 1 t2 d 1 t2 e 1 t2 f 1 table type possible_keys key key_len ref rows Extra t1 ALL NULL NULL NULL NULL 4 t2 ALL NULL NULL NULL NULL 4
mysql-test/t/union.test +0 −1 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ select a,b from t1 union select a,b from t1; select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 group by b; # Test some error conditions with UNION --error 1215 explain select a,b from t1 union all select a,b from t2; --error 1215 Loading
sql/sql_select.cc +20 −17 Original line number Diff line number Diff line Loading @@ -6752,6 +6752,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, /* Don't log this into the slow query log */ join->thd->lex.select_lex.options&= ~(QUERY_NO_INDEX_USED | QUERY_NO_GOOD_INDEX_USED); if (join->thd->lex.select == &join->thd->lex.select_lex) { field_list.push_back(new Item_empty_string("table",NAME_LEN)); field_list.push_back(new Item_empty_string("type",10)); field_list.push_back(item=new Item_empty_string("possible_keys", Loading @@ -6767,8 +6769,8 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, field_list.push_back(new Item_real("rows",0.0,0,10)); field_list.push_back(new Item_empty_string("Extra",255)); if (send_fields(thd,field_list,1)) return; /* purecov: inspected */ return; } char buff[512],*buff_ptr; String tmp(buff,sizeof(buff)),*packet= &thd->packet; table_map used_tables=0; Loading Loading @@ -6899,6 +6901,7 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, // For next iteration used_tables|=table->map; } if (!join->thd->lex.select->next) send_eof(&thd->net); DBUG_VOID_RETURN; } Loading
sql/sql_union.cc +19 −6 Original line number Diff line number Diff line Loading @@ -38,12 +38,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) uint elements; DBUG_ENTER("mysql_union"); if (lex->select_lex.options & SELECT_DESCRIBE) { my_error(ER_WRONG_USAGE,MYF(0),"DESCRIBE","UNION"); return -1; } /* Fix tables--to-be-unioned-from list to point at opened tables */ for (sl=&lex->select_lex; sl; sl=sl->next) { Loading @@ -66,6 +60,25 @@ int mysql_union(THD *thd, LEX *lex,select_result *result) } } if (lex->select_lex.options & SELECT_DESCRIBE) { for (sl= &lex->select_lex; sl; sl=sl->next) { lex->select=sl; res=mysql_select(thd, (TABLE_LIST*) sl->table_list.first, sl->item_list, sl->where, sl->ftfunc_list, (ORDER*) 0, (ORDER*) sl->group_list.first, sl->having, (ORDER*) NULL, sl->options | thd->options | SELECT_NO_UNLOCK | SELECT_DESCRIBE, result); } return 0; } order = (ORDER *) last_sl->order_list.first; { Item *item; Loading