Commit ae1b3d19 authored by Igor Babaev's avatar Igor Babaev

Fixed bug mdev-10705.

The fix for bug mdev-5104 did not take into account that
for any call of setup_order the size of ref_array must
be big enough. This patch fixes this problem.
parent 9e528d4f
......@@ -2050,4 +2050,15 @@ t2 A, t2 B
where A.b = B.b
order by A.col2, B.col2 limit 10, 1000000;
drop table t1,t2,t3;
#
# mdev-10705 : long order by list that can be skipped
#
SELECT 1
UNION
( SELECT 2
ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3,
@a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 );
1
1
2
End of 5.5 tests
......@@ -1746,6 +1746,16 @@ order by A.col2, B.col2 limit 10, 1000000;
drop table t1,t2,t3;
--echo #
--echo # mdev-10705 : long order by list that can be skipped
--echo #
SELECT 1
UNION
( SELECT 2
ORDER BY NULL, @a0 := 3, @a1 := 3, @a2 := 3, @a3 := 3, @a4 := 3,
@a5 := 3, @a6 := 3, @a7 := 3, @a8 := 3, @a9 := 3, @a10 := 3 );
--echo End of 5.5 tests
......@@ -714,10 +714,15 @@ JOIN::prepare(Item ***rref_pointer_array,
if (mixed_implicit_grouping && tbl->table)
tbl->table->maybe_null= 1;
}
uint real_og_num= og_num;
if (skip_order_by &&
select_lex != select_lex->master_unit()->global_parameters)
real_og_num+= select_lex->order_list.elements;
if ((wild_num && setup_wild(thd, tables_list, fields_list, &all_fields,
wild_num)) ||
select_lex->setup_ref_array(thd, og_num) ||
select_lex->setup_ref_array(thd, real_og_num) ||
setup_fields(thd, (*rref_pointer_array), fields_list, MARK_COLUMNS_READ,
&all_fields, 1) ||
setup_without_group(thd, (*rref_pointer_array), tables_list,
......
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