~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# Bug31048: Many nested subqueries may cause server crash.
#
create table t1(a int,b int,key(a),key(b));
insert into t1(a,b) values (1,2),(2,1),(2,3),(3,4),(5,4),(5,5),
  (6,7),(7,4),(5,3);

let $nesting= 26;
let $should_work_nesting= 5;
let $start= select sum(a),a from t1 where a> ( select sum(a) from t1 ;
let $end= )group by a ;
let $start_app= where a> ( select sum(a) from t1 ;
let $end_pre= )group by b limit 1 ;

--disable_result_log
--disable_query_log
# At least 4 level nesting should work without errors
while ($should_work_nesting)
{
--echo $should_work_nesting
  eval $start $end;
  eval explain $start $end;
  let $start= $start
  $start_app;
  let $end= $end_pre
  $end;
  dec $should_work_nesting;
}
# Other may fail with the 'stack overrun error'
while ($nesting)
{
--echo $nesting
--error EE_OK,ER_STACK_OVERRUN_NEED_MORE
  eval $start $end;
--error EE_OK,ER_STACK_OVERRUN_NEED_MORE
  eval explain $start $end;
  let $start= $start
  $start_app;
  let $end= $end_pre
  $end;
  dec $nesting;
}
--enable_result_log
--enable_query_log
drop table t1;

--echo End of 5.1 tests