diff --git a/mysql-test/r/index_merge.result b/mysql-test/r/index_merge.result
index 15e909c5af903977255b35d03334f4e0c6d5bbda..da86cc2910eed547e1debb50a6fb788ef08ea40f 100644
--- a/mysql-test/r/index_merge.result
+++ b/mysql-test/r/index_merge.result
@@ -280,6 +280,7 @@ union select * from t1 where key1<4 or key3=5;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	index_merge	i1,i2	i1,i2	4,4	NULL	2	Using where
 2	UNION	t1	index_merge	i1,i3	i1,i3	4,4	NULL	5	Using where
+NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	
 explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 0ce6901897ae78788649f2bada359b37ae20c8c8..1ca2a412512c127ee37dbc45cc7e7502aafb68ca 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -646,6 +646,7 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
 {
   index= key_nr;
   head=  table;
+  key_part_info= head->key_info[index].key_part;
   my_init_dynamic_array(&ranges, sizeof(QUICK_RANGE*), 16, 16);
 
   if (!no_alloc && !parent_alloc)
@@ -662,8 +663,8 @@ QUICK_RANGE_SELECT::QUICK_RANGE_SELECT(THD *thd, TABLE *table, uint key_nr,
 
 int QUICK_RANGE_SELECT::init()
 {
-  key_part_info= head->key_info[index].key_part;
-  return (error= file->index_init(index));
+  DBUG_ENTER("QUICK_RANGE_SELECT::init");
+  DBUG_RETURN(error= file->index_init(index));
 }
 
 QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT()
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3b027788ce8a53623c75073235a452770aa673b0..07b70d2699780d0e531e4aa929327bcb4bf32773 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10450,6 +10450,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
   else
   {
     thd->lex->current_select= first;
+    unit->set_limit(unit->global_parameters, first);
     res= mysql_select(thd, &first->ref_pointer_array,
 			(TABLE_LIST*) first->table_list.first,
 			first->with_wild, first->item_list,