~vlad-lesin/percona-server/mysql-5.0.33-original

« back to all changes in this revision

Viewing changes to mysql-test/t/sp-big.test

  • Committer: Vlad Lesin
  • Date: 2012-07-31 09:21:34 UTC
  • Revision ID: vladislav.lesin@percona.com-20120731092134-zfodx022b7992wsi
VirginĀ 5.0.33

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Bug #11602: SP with very large body not handled well
 
3
#
 
4
 
 
5
--disable_warnings
 
6
drop procedure if exists test.longprocedure;
 
7
drop table if exists t1;
 
8
--enable_warnings
 
9
 
 
10
create table t1 (a int);
 
11
insert into t1 values (1),(2),(3);
 
12
 
 
13
let $body=`select repeat('select count(*) into out1 from t1;\n', 3072)`;
 
14
 
 
15
delimiter //;
 
16
--disable_query_log
 
17
eval select length('$body') as length//
 
18
eval create procedure test.longprocedure (out out1 int) deterministic
 
19
begin
 
20
  $body
 
21
end//
 
22
--enable_query_log
 
23
 
 
24
delimiter ;//
 
25
 
 
26
# this is larger than the length above, because it includes the 'begin' and
 
27
# 'end' bits and some whitespace
 
28
select length(routine_definition) from information_schema.routines where routine_schema = 'test' and routine_name = 'longprocedure';
 
29
 
 
30
call test.longprocedure(@value); select @value;
 
31
 
 
32
drop procedure test.longprocedure;
 
33
drop table t1;
 
34
#
 
35
# Bug #9819 "Cursors: Mysql Server Crash while fetching from table with 5
 
36
# million records.": 
 
37
# To really test the bug, increase the number of loop iterations ($1).
 
38
# For 4 millions set $1 to 22.
 
39
create table t1 (f1 char(100) , f2 mediumint , f3 int , f4 real, f5 numeric);
 
40
insert into t1 (f1, f2, f3, f4, f5) values
 
41
("This is a test case for for Bug#9819", 1, 2, 3.0, 4.598);
 
42
create table t2 like t1;
 
43
let $1=8;
 
44
--disable_query_log
 
45
--disable_result_log
 
46
while ($1)
 
47
{
 
48
  eval insert into t1 select * from t1;
 
49
  dec $1;
 
50
}
 
51
--enable_result_log
 
52
--enable_query_log
 
53
select count(*) from t1;
 
54
select count(*) from t2;
 
55
--disable_warnings
 
56
drop procedure if exists p1;
 
57
--enable_warnings
 
58
delimiter |;
 
59
create procedure p1()
 
60
begin
 
61
  declare done integer default 0;
 
62
  declare vf1 char(100) ;
 
63
  declare vf2 mediumint;
 
64
  declare vf3 int ;
 
65
  declare vf4 real ;
 
66
  declare vf5 numeric ;
 
67
  declare cur1 cursor for select f1,f2,f3,f4,f5 from t1;  
 
68
  declare continue handler for sqlstate '02000' set done = 1; 
 
69
  open cur1;
 
70
  while done <> 1 do
 
71
    fetch cur1 into vf1, vf2, vf3, vf4, vf5;
 
72
    if not done then
 
73
      insert into t2 values (vf1, vf2, vf3, vf4, vf5);
 
74
    end if;
 
75
  end while;
 
76
  close cur1;
 
77
end|
 
78
delimiter ;|
 
79
call p1();
 
80
select count(*) from t1;
 
81
select count(*) from t2;
 
82
select f1 from t1 limit 1;
 
83
select f1 from t2 limit 1;
 
84
drop procedure p1;
 
85
drop table t1, t2;