Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
b17326a3
Commit
b17326a3
authored
Dec 28, 2004
by
pem@mysql.comhem.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverted previous name changes of all bug tests in sp.test, but kept the
robustness (dropping things just in case).
parent
32757a34
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
643 additions
and
150 deletions
+643
-150
mysql-test/r/sp.result
mysql-test/r/sp.result
+188
-74
mysql-test/t/sp.test
mysql-test/t/sp.test
+455
-76
No files found.
mysql-test/r/sp.result
View file @
b17326a3
use test;
drop table if exists t1,t2,t3,t4;
drop procedure if exists goto1;
drop procedure if exists goto2;
drop procedure if exists goto3;
drop procedure if exists goto4;
drop procedure if exists goto5;
drop procedure if exists goto6;
drop procedure if exists into_outfile;
drop procedure if exists into_dumpfile;
drop procedure if exists create_select;
drop procedure if exists bar;
drop procedure if exists hndlr1;
drop procedure if exists hndlr2;
drop procedure if exists hndlr3;
drop procedure if exists hndlr4;
drop procedure if exists cur1;
drop procedure if exists cur2;
drop procedure if exists chistics;
drop procedure if exists chistics2;
drop procedure if exists modes;
drop procedure if exists dummy;
drop procedure if exists bug;
drop procedure if exists bug2;
drop function if exists fac;
drop table if exists t1;
create table t1 (
id char(16) not null,
data int not null
);
drop table if exists t2;
create table t2 (
s char(16),
i int,
d double
);
drop procedure if exists foo42;
create procedure foo42()
insert into test.t1 values ("foo", 42);
call foo42();
...
...
@@ -40,6 +19,7 @@ id data
foo 42
delete from t1;
drop procedure foo42;
drop procedure if exists bar;
create procedure bar(x char(16), y int)
insert into test.t1 values (x, y);
call bar("bar", 666);
...
...
@@ -47,11 +27,13 @@ select * from t1;
id data
bar 666
delete from t1;
drop procedure if exists empty|
create procedure empty()
begin
end|
call empty()|
drop procedure empty|
drop procedure if exists scope|
create procedure scope(a int, b float)
begin
declare b int;
...
...
@@ -61,6 +43,7 @@ declare c int;
end;
end|
drop procedure scope|
drop procedure if exists two|
create procedure two(x1 char(16), x2 char(16), y int)
begin
insert into test.t1 values (x1, y);
...
...
@@ -73,6 +56,7 @@ one 3
two 3
delete from t1|
drop procedure two|
drop procedure if exists locset|
create procedure locset(x char(16), y int)
begin
declare z1, z2 int;
...
...
@@ -86,6 +70,7 @@ id data
locset 21
delete from t1|
drop procedure locset|
drop procedure if exists setcontext|
create procedure setcontext()
begin
declare data int default 2;
...
...
@@ -100,7 +85,9 @@ foo 1
kaka 3
delete from t1|
drop procedure setcontext|
drop table if exists t3|
create table t3 ( d date, i int, f double, s varchar(32) )|
drop procedure if exists nullset|
create procedure nullset()
begin
declare ld date;
...
...
@@ -128,6 +115,7 @@ NULL NULL NULL lf = 0
NULL 1 1 ls is null
drop table t3|
drop procedure nullset|
drop procedure if exists mixset|
create procedure mixset(x char(16), y int)
begin
declare z int;
...
...
@@ -143,12 +131,14 @@ id data @z
mixset 666 19
delete from t1|
drop procedure mixset|
drop procedure if exists zip|
create procedure zip(x char(16), y int)
begin
declare z int;
call zap(y, z);
call bar(x, z);
end|
drop procedure if exists zap|
create procedure zap(x int, out y int)
begin
declare z int;
...
...
@@ -166,12 +156,16 @@ select @zap|
@zap
8
drop procedure zap|
drop procedure if exists c1|
create procedure c1(x int)
call c2("c", x)|
drop procedure if exists c2|
create procedure c2(s char(16), x int)
call c3(x, s)|
drop procedure if exists c3|
create procedure c3(x int, s char(16))
call c4("level", x, s)|
drop procedure if exists c4|
create procedure c4(l char(8), x int, s char(16))
insert into t1 values (concat(l,s), x)|
call c1(42)|
...
...
@@ -183,16 +177,19 @@ drop procedure c1|
drop procedure c2|
drop procedure c3|
drop procedure c4|
drop procedure if exists iotest|
create procedure iotest(x1 char(16), x2 char(16), y int)
begin
call inc2(x2, y);
insert into test.t1 values (x1, y);
end|
drop procedure if exists inc2|
create procedure inc2(x char(16), y int)
begin
call inc(y);
insert into test.t1 values (x, y);
end|
drop procedure if exists inc|
create procedure inc(inout io int)
set io = io + 1|
call iotest("io1", "io2", 1)|
...
...
@@ -203,6 +200,7 @@ io1 1
delete from t1|
drop procedure iotest|
drop procedure inc2|
drop procedure if exists incr|
create procedure incr(inout x int)
call inc(x)|
select @zap|
...
...
@@ -214,12 +212,14 @@ select @zap|
9
drop procedure inc|
drop procedure incr|
drop procedure if exists cbv1|
create procedure cbv1()
begin
declare y int default 3;
call cbv2(y+1, y);
insert into test.t1 values ("cbv1", y);
end|
drop procedure if exists cbv2|
create procedure cbv2(y1 int, inout y2 int)
begin
set y2 = 4711;
...
...
@@ -234,8 +234,10 @@ delete from t1|
drop procedure cbv1|
drop procedure cbv2|
insert into t2 values ("a", 1, 1.1), ("b", 2, 1.2), ("c", 3, 1.3)|
drop procedure if exists sub1|
create procedure sub1(id char(16), x int)
insert into test.t1 values (id, x)|
drop procedure if exists sub3|
create function sub3(i int) returns int
return i+1|
call sub1("sub1a", (select 7))|
...
...
@@ -254,6 +256,7 @@ sub3((select max(i) from t2))
drop procedure sub1|
drop function sub3|
delete from t2|
drop procedure if exists a0|
create procedure a0(x int)
while x do
set x = x-1;
...
...
@@ -271,6 +274,7 @@ a0 1
a0 0
delete from t1|
drop procedure a0|
drop procedure if exists a|
create procedure a(x int)
while x > 0 do
set x = x-1;
...
...
@@ -284,6 +288,7 @@ a 1
a 0
delete from t1|
drop procedure a|
drop procedure if exists b|
create procedure b(x int)
repeat
insert into test.t1 values (repeat("b",3), x);
...
...
@@ -297,12 +302,14 @@ bbb 2
bbb 1
delete from t1|
drop procedure b|
drop procedure if exists b2|
create procedure b2(x int)
repeat(select 1 into outfile 'b2');
insert into test.t1 values (repeat("b2",3), x);
set x = x-1;
until x = 0 end repeat|
drop procedure b2|
drop procedure if exists c|
create procedure c(x int)
hmm: while x > 0 do
insert into test.t1 values ("c", x);
...
...
@@ -318,6 +325,7 @@ c 2
c 1
delete from t1|
drop procedure c|
drop procedure if exists d|
create procedure d(x int)
hmm: while x > 0 do
insert into test.t1 values ("d", x);
...
...
@@ -331,6 +339,7 @@ id data
d 3
delete from t1|
drop procedure d|
drop procedure if exists e|
create procedure e(x int)
foo: loop
if x = 0 then
...
...
@@ -347,6 +356,7 @@ e 2
e 1
delete from t1|
drop procedure e|
drop procedure if exists f|
create procedure f(x int)
if x < 0 then
insert into test.t1 values ("f", 0);
...
...
@@ -365,6 +375,7 @@ f 1
f 2
delete from t1|
drop procedure f|
drop procedure if exists g|
create procedure g(x int)
case
when x < 0 then
...
...
@@ -384,6 +395,7 @@ g 1
g 2
delete from t1|
drop procedure g|
drop procedure if exists h|
create procedure h(x int)
case x
when 0 then
...
...
@@ -403,6 +415,7 @@ h1 1
h? 17
delete from t1|
drop procedure h|
drop procedure if exists i|
create procedure i(x int)
foo:
begin
...
...
@@ -418,6 +431,7 @@ id data
i 3
delete from t1|
drop procedure i|
drop procedure if exists goto1|
create procedure goto1()
begin
declare y int;
...
...
@@ -443,6 +457,7 @@ j 0
j 1
j 2
drop procedure goto1|
drop procedure if exists goto2|
create procedure goto2(a int)
begin
declare x int default 0;
...
...
@@ -499,6 +514,7 @@ j 1
j 2
drop procedure goto2|
delete from t1|
drop procedure if exists goto3|
create procedure goto3()
begin
label L1;
...
...
@@ -507,6 +523,7 @@ end;
goto L1;
end|
drop procedure goto3|
drop procedure if exists goto4|
create procedure goto4()
begin
begin
...
...
@@ -517,6 +534,7 @@ end;
end;
end|
drop procedure goto4|
drop procedure if exists goto5|
create procedure goto5()
begin
begin
...
...
@@ -527,6 +545,7 @@ label lab1;
end;
end|
drop procedure goto5|
drop procedure if exists goto6|
create procedure goto6()
begin
label L1;
...
...
@@ -553,6 +572,7 @@ end|
drop procedure goto6|
insert into t1 values ("foo", 3), ("bar", 19)|
insert into t2 values ("x", 9, 4.1), ("y", -1, 19.2), ("z", 3, 2.2)|
drop procedure if exists sel1|
create procedure sel1()
begin
select * from t1;
...
...
@@ -562,6 +582,7 @@ id data
foo 3
bar 19
drop procedure sel1|
drop procedure if exists sel2|
create procedure sel2()
begin
select * from t1;
...
...
@@ -578,6 +599,7 @@ z 3 2.2
drop procedure sel2|
delete from t1|
delete from t2|
drop procedure if exists into_test|
create procedure into_test(x char(16), y int)
begin
insert into test.t1 values (x, y);
...
...
@@ -591,6 +613,7 @@ into 100
into2 102
delete from t1|
drop procedure into_test|
drop procedure if exists into_tes2|
create procedure into_test2(x char(16), y int)
begin
insert into test.t1 values (x, y);
...
...
@@ -604,6 +627,7 @@ into 100 100
into2 102 100
delete from t1|
drop procedure into_test2|
drop procedure if exists into_test3|
create procedure into_test3()
begin
declare x char(16);
...
...
@@ -621,6 +645,7 @@ into3 19 0
delete from t1|
delete from t2|
drop procedure into_test3|
drop procedure if exists into_test4|
create procedure into_test4()
begin
declare x int;
...
...
@@ -644,6 +669,7 @@ into4 77
delete from t1|
drop table t3|
drop procedure into_test4|
drop procedure if exists into_outfile|
create procedure into_outfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
...
...
@@ -653,6 +679,7 @@ end|
call into_outfile("ofile", 1)|
delete from t1|
drop procedure into_outfile|
drop procedure if exists into_dumpfile|
create procedure into_dumpfile(x char(16), y int)
begin
insert into test.t1 values (x, y);
...
...
@@ -662,6 +689,7 @@ end|
call into_dumpfile("dfile", 1)|
delete from t1|
drop procedure into_dumpfile|
drop procedure if exists create_select|
create procedure create_select(x char(16), y int)
begin
insert into test.t1 values (x, y);
...
...
@@ -677,27 +705,32 @@ cs 90 cs2 92
drop table if exists t3|
delete from t1|
drop procedure create_select|
drop function if exists e|
create function e() returns double
return 2.7182818284590452354|
set @e = e()|
select e(), @e|
e() @e
2.718281828459 2.718281828459
drop function if exists inc|
create function inc(i int) returns int
return i+1|
select inc(1), inc(99), inc(-71)|
inc(1) inc(99) inc(-71)
2 100 -70
drop function if exists mul|
create function mul(x int, y int) returns int
return x*y|
select mul(1,1), mul(3,5), mul(4711, 666)|
mul(1,1) mul(3,5) mul(4711, 666)
1 15 3137526
drop function if exists append|
create function append(s1 char(8), s2 char(8)) returns char(16)
return concat(s1, s2)|
select append("foo", "bar")|
append("foo", "bar")
foobar
drop function if exists fac|
create function fac(n int unsigned) returns bigint unsigned
begin
declare f bigint unsigned default 1;
...
...
@@ -710,6 +743,7 @@ end|
select fac(1), fac(2), fac(5), fac(10)|
fac(1) fac(2) fac(5) fac(10)
1 2 120 3628800
drop function if exists fun|
create function fun(d double, i int, u int unsigned) returns double
return mul(inc(i), fac(u)) / e()|
select fun(2.3, 3, 5)|
...
...
@@ -737,6 +771,7 @@ drop function inc|
drop function mul|
drop function append|
drop function fun|
drop procedure if exists hndlr1|
create procedure hndlr1(val int)
begin
declare x int default 0;
...
...
@@ -755,6 +790,7 @@ id data
hndlr1 42
delete from t1|
drop procedure hndlr1|
drop procedure if exists hndlr2|
create procedure hndlr2(val int)
begin
declare x int default 0;
...
...
@@ -770,6 +806,7 @@ id data
hndlr2 1
delete from t1|
drop procedure hndlr2|
drop procedure if exists hndlr3|
create procedure hndlr3(val int)
begin
declare x int default 0;
...
...
@@ -798,6 +835,7 @@ delete from t1|
drop procedure hndlr3|
drop table if exists t3|
create table t3 ( id char(16), data int )|
drop procedure if exists hndlr4|
create procedure hndlr4()
begin
declare x int default 0;
...
...
@@ -812,6 +850,7 @@ id data
z NULL
drop table t3|
drop procedure hndlr4|
drop procedure if exists cur1|
create procedure cur1()
begin
declare a char(16);
...
...
@@ -839,6 +878,7 @@ zap 663
drop procedure cur1|
drop table if exists t3|
create table t3 ( s char(16), i int )|
drop procedure if exists cur2|
create procedure cur2()
begin
declare done int default 0;
...
...
@@ -875,6 +915,7 @@ delete from t1|
delete from t2|
drop table t3|
drop procedure cur2|
drop procedure if exists chistics|
create procedure chistics()
language sql
modifies sql data
...
...
@@ -902,6 +943,7 @@ chistics CREATE PROCEDURE `test`.`chistics`()
COMMENT 'Characteristics procedure test'
insert into t1 values ("chistics", 1)
drop procedure chistics|
drop function if exists chistics|
create function chistics() returns int
language sql
deterministic
...
...
@@ -932,6 +974,7 @@ return 42
drop function chistics|
insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
set @@sql_mode = 'ANSI'|
drop procedure if exists modes$
create procedure modes(out c1 int, out c2 int)
begin
declare done int default 0;
...
...
@@ -968,12 +1011,14 @@ use test|
drop database sp_db2|
create database sp_db3|
use sp_db3|
drop procedure if exists dummy|
create procedure dummy(out x int)
set x = 42|
use test|
drop database sp_db3|
select type,db,name from mysql.proc where db = 'sp_db3'|
type db name
drop procedure if exists rc|
create procedure rc()
begin
delete from t1;
...
...
@@ -1001,7 +1046,8 @@ select row_count()|
row_count()
-1
drop procedure rc|
create procedure bug(a_id char(16), a_data int)
drop procedure if exists bug822|
create procedure bug822(a_id char(16), a_data int)
begin
declare n int;
select count(*) into n from t1 where id = a_id and data = a_data;
...
...
@@ -1009,16 +1055,17 @@ if n = 0 then
insert into t1 (id, data) values (a_id, a_data);
end if;
end|
call bug('foo', 42)|
call bug('foo', 42)|
call bug('bar', 666)|
call bug
822
('foo', 42)|
call bug
822
('foo', 42)|
call bug
822
('bar', 666)|
select * from t1|
id data
foo 42
bar 666
delete from t1|
drop procedure bug|
create procedure bug()
drop procedure bug822|
drop procedure if exists bug1495|
create procedure bug1495()
begin
declare x int;
select data into x from t1 order by id limit 1;
...
...
@@ -1029,18 +1076,19 @@ insert into t1 values ("more", x+10);
end if;
end|
insert into t1 values ('foo', 12)|
call bug()|
call bug
1495
()|
delete from t1 where id='foo'|
insert into t1 values ('bar', 7)|
call bug()|
call bug
1495
()|
delete from t1 where id='bar'|
select * from t1|
id data
less 2
more 17
delete from t1|
drop procedure bug|
create procedure bug(s char(16))
drop procedure bug1495|
drop procedure if exists bug1547|
create procedure bug1547(s char(16))
begin
declare x int;
select data into x from t1 where s = id limit 1;
...
...
@@ -1051,8 +1099,8 @@ insert into t1 values ("more", x+10);
end if;
end|
insert into t1 values ("foo", 12), ("bar", 7)|
call bug("foo")|
call bug("bar")|
call bug
1547
("foo")|
call bug
1547
("bar")|
select * from t1|
id data
foo 12
...
...
@@ -1060,34 +1108,37 @@ bar 7
less 2
more 17
delete from t1|
drop procedure bug|
drop procedure bug
1547
|
drop table if exists t70|
create table t70 (s1 int,s2 int)|
insert into t70 values (1,2)|
create procedure bug(out p1 int, out p2 int)
drop procedure if exists bug1656|
create procedure bug1656(out p1 int, out p2 int)
select * into p1, p1 from t70|
call bug(@1, @2)|
call bug
1656
(@1, @2)|
select @1, @2|
@1 @2
2 NULL
drop table t70|
drop procedure bug|
drop procedure bug
1656
|
drop table if exists t3|
create table t3(a int)|
create procedure bug()
drop procedure if exists bug1862|
create procedure bug1862()
begin
insert into t3 values(2);
flush tables;
end|
call bug()|
call bug()|
call bug
1862
()|
call bug
1862
()|
select * from t3|
a
2
2
drop table t3|
drop procedure bug|
create procedure bug()
drop procedure bug1862|
drop procedure if exists bug1874|
create procedure bug1874()
begin
declare x int;
declare y double;
...
...
@@ -1101,7 +1152,7 @@ select avg(data) into y from t1;
insert into t2 values ("avg", 0, y);
end|
insert into t1 (data) values (3), (1), (5), (9), (4)|
call bug()|
call bug
1874
()|
select * from t2|
s i d
max 9 0
...
...
@@ -1110,8 +1161,9 @@ sum 22 0
avg 0 4.4
delete from t1|
delete from t2|
drop procedure bug|
create procedure bug()
drop procedure bug1874|
drop procedure if exists bug2260|
create procedure bug2260()
begin
declare v1 int;
declare c1 cursor for select data from t1;
...
...
@@ -1121,23 +1173,27 @@ fetch c1 into v1;
set @x2 = 2;
close c1;
end|
call bug()|
call bug
2260
()|
select @x2|
@x2
2
drop procedure bug|
drop procedure bug2260|
drop procedure if exists bug2267_1|
create procedure bug2267_1()
begin
show procedure status;
end|
drop procedure if exists bug2267_2|
create procedure bug2267_2()
begin
show function status;
end|
drop procedure if exists bug2267_3|
create procedure bug2267_3()
begin
show create procedure bug2267_1;
end|
drop procedure if exists bug2267_4|
create procedure bug2267_4()
begin
show create function fac;
...
...
@@ -1172,38 +1228,44 @@ drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
create procedure bug(x int)
drop procedure if exists bug2227|
create procedure bug2227(x int)
begin
declare y float default 2.6;
declare z char(16) default "zzz";
select 1.3, x, y, 42, z;
end|
call bug(9)|
call bug
2227
(9)|
1.3 x y 42 z
1.3 9 2.6 42 zzz
drop procedure bug|
create procedure bug()
drop procedure bug2227|
drop procedure if exists bug2614|
create procedure bug2614()
begin
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
call bug()|
call bug()|
call bug
2614
()|
call bug
2614
()|
drop table t3|
drop procedure bug|
create function bug () returns int
drop procedure bug2614|
drop function if exists bug2674|
create function bug2674() returns int
return @@sort_buffer_size|
set @osbs = @@sort_buffer_size|
set @@sort_buffer_size = 262000|
select bug()|
bug()
select bug
2674
()|
bug
2674
()
262000
drop function bug|
drop function bug
2674
|
set @@sort_buffer_size = @osbs|
drop procedure if exists bug3259_1 |
create procedure bug3259_1 () begin end|
drop procedure if exists BUG3259_2 |
create procedure BUG3259_2 () begin end|
drop procedure if exists Bug3259_3 |
create procedure Bug3259_3 () begin end|
call BUG3259_1()|
call BUG3259_1()|
...
...
@@ -1214,48 +1276,52 @@ call bUG3259_3()|
drop procedure bUg3259_1|
drop procedure BuG3259_2|
drop procedure BUG3259_3|
create function bug() returns char(10) character set latin2
drop function if exists bug2772|
create function bug2772() returns char(10) character set latin2
return 'a'|
select bug()|
bug()
select bug
2772
()|
bug
2772
()
a
drop function bug|
create procedure bug(out x int)
drop function bug2772|
drop procedure if exists bug2776_1|
create procedure bug2776_1(out x int)
begin
declare v int;
set v = default;
set x = v;
end|
create procedure bug2(out x int)
drop procedure if exists bug2776_2|
create procedure bug2776_2(out x int)
begin
declare v int default 42;
set v = default;
set x = v;
end|
set @x = 1|
call bug(@x)|
call bug
2776_1
(@x)|
select @x|
@x
NULL
call bug2(@x)|
call bug2
776_2
(@x)|
select @x|
@x
42
drop procedure bug|
drop procedure bug2|
drop procedure bug
2776_1
|
drop procedure bug2
776_2
|
drop table if exists t3|
create table t3 (s1 smallint)|
insert into t3 values (123456789012)|
Warnings:
Warning 1264 Out of range value adjusted for column 's1' at row 1
create procedure bug()
drop procedure if exists bug2780|
create procedure bug2780()
begin
declare exit handler for sqlwarning set @x = 1;
set @x = 0;
insert into t3 values (123456789012);
insert into t3 values (0);
end|
call bug()|
call bug
2780
()|
select @x|
@x
1
...
...
@@ -1263,12 +1329,13 @@ select * from t3|
s1
32767
32767
drop procedure bug|
drop procedure bug
2780
|
drop table t3|
create table t3 (content varchar(10) )|
insert into t3 values ("test1")|
insert into t3 values ("test2")|
create table t4 (f1 int, rc int, t3 int)|
drop procedure if exists bug1863|
create procedure bug1863(in1 int)
begin
declare ind int default 0;
...
...
@@ -1314,6 +1381,7 @@ insert t3 (OrderID,MarketID) values (1,1)|
insert t3 (OrderID,MarketID) values (2,2)|
insert t4 (MarketID,Market,Status) values (1,"MarketID One","A")|
insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|
drop procedure if exists bug2656_1|
create procedure bug2656_1()
begin
select
...
...
@@ -1321,6 +1389,7 @@ m.Market
from t4 m JOIN t3 o
ON o.MarketID != 1 and o.MarketID = m.MarketID;
end |
drop procedure if exists bug2656_2|
create procedure bug2656_2()
begin
select
...
...
@@ -1345,6 +1414,7 @@ MarketID Two
drop procedure bug2656_1|
drop procedure bug2656_2|
drop table t3, t4|
drop procedure if exists bug3426|
create procedure bug3426(in_time int unsigned, out x int)
begin
if in_time is null then
...
...
@@ -1389,6 +1459,7 @@ Warning 1265 Data truncated for column 'ach' at row 2
insert into t4 values (1 , 'bCh1' )|
Warnings:
Warning 1265 Data truncated for column 'bch' at row 1
drop procedure if exists bug3448|
create procedure bug3448()
select * from t3 inner join t4 on t3.a = t4.b|
select * from t3 inner join t4 on t3.a = t4.b|
...
...
@@ -1416,6 +1487,7 @@ insert into t3 (title,body) values
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...')|
drop procedure if exists bug3734 |
create procedure bug3734 (param1 varchar(100))
select * from t3 where match (title,body) against (param1)|
call bug3734('database')|
...
...
@@ -1427,6 +1499,7 @@ id title body
6 MySQL Security When configured properly, MySQL ...
drop procedure bug3734|
drop table t3|
drop procedure if exists bug3863|
create procedure bug3863()
begin
set @a = 0;
...
...
@@ -1450,6 +1523,7 @@ msg text not null,
primary key (id),
unique key rid (rid, id)
)|
drop procedure if exists bug2460_1|
create procedure bug2460_1(in v int)
begin
( select n0.id from t3 as n0 where n0.id = v )
...
...
@@ -1473,6 +1547,7 @@ call bug2460_1(2)|
id
2
1
drop procedure if exists bug2460_2|
create procedure bug2460_2()
begin
drop table if exists t3;
...
...
@@ -1488,16 +1563,20 @@ drop procedure bug2460_1|
drop procedure bug2460_2|
drop table t3|
set @@sql_mode = ''|
drop procedure if exists bug2564_1|
create procedure bug2564_1()
comment 'Joe''s procedure'
insert into `t1` values ("foo", 1)|
set @@sql_mode = 'ANSI_QUOTES'|
drop procedure if exists bug2564_2|
create procedure bug2564_2()
insert into "t1" values ('foo', 1)|
set @@sql_mode = ''$
drop function if exists bug2564_3$
create function bug2564_3(x int, y int) returns int
return x || y$
set @@sql_mode = 'ANSI'$
drop function if exists bug2564_4$
create function bug2564_4(x int, y int) returns int
return x || y$
set @@sql_mode = ''|
...
...
@@ -1522,6 +1601,7 @@ drop procedure bug2564_1|
drop procedure bug2564_2|
drop function bug2564_3|
drop function bug2564_4|
drop function if exists bug3132|
create function bug3132(s char(20)) returns char(50)
return concat('Hello, ', s, '!')|
select bug3132('Bob') union all select bug3132('Judy')|
...
...
@@ -1529,6 +1609,7 @@ bug3132('Bob')
Hello, Bob!
Hello, Judy!
drop function bug3132|
drop procedure if exists bug3843|
create procedure bug3843()
analyze table t1|
call bug3843()|
...
...
@@ -1544,6 +1625,7 @@ drop procedure bug3843|
drop table if exists t3|
create table t3 ( s1 char(10) )|
insert into t3 values ('a'), ('b')|
drop procedure if exists bug3368|
create procedure bug3368(v char(10))
begin
select group_concat(v) from t3;
...
...
@@ -1559,6 +1641,10 @@ drop table t3|
drop table if exists t3|
create table t3 (f1 int, f2 int);
insert into t3 values (1,1);
--disable_warnings|
drop procedure if exists bug4579_1|
Warnings:
Note 1305 PROCEDURE bug4579_1 does not exist
create procedure bug4579_1 ()
begin
declare sf1 int;
...
...
@@ -1566,6 +1652,7 @@ select f1 into sf1 from t3 where f1=1 and f2=1;
update t3 set f2 = f2 + 1 where f1=1 and f2=1;
call bug4579_2();
end|
drop procedure if exists bug4579_2|
create procedure bug4579_2 ()
begin
end|
...
...
@@ -1580,6 +1667,7 @@ drop table t3|
drop table if exists t3|
create table t3 (f1 int, f2 int, f3 int)|
insert into t3 values (1,1,1)|
drop procedure if exists bug4726|
create procedure bug4726()
begin
declare tmp_o_id INT;
...
...
@@ -1599,6 +1687,7 @@ drop table t3|
drop table if exists t3|
create table t3 (s1 int)|
insert into t3 values (3), (4)|
drop procedure if exists bug4318|
create procedure bug4318()
handler t3 read next|
handler t3 open|
...
...
@@ -1611,6 +1700,7 @@ s1
handler t3 close|
drop procedure bug4318|
drop table t3|
drop procedure if exists bug4902|
create procedure bug4902()
begin
show charset like 'foo';
...
...
@@ -1737,6 +1827,7 @@ Tables_in_test (foo)
Variable_name Value
Level Code Message
drop procedure bug4902|
drop procedure if exists bug4902_2|
create procedure bug4902_2()
begin
show processlist;
...
...
@@ -1749,6 +1840,7 @@ Id User Host db Command Time State Info
# root localhost test Query # NULL show processlist
drop procedure bug4902_2|
drop table if exists t3|
drop procedure if exists bug4904|
create procedure bug4904()
begin
declare continue handler for sqlstate 'HY000' begin end;
...
...
@@ -1758,6 +1850,7 @@ call bug4904()|
ERROR 42S02: Table 'test.t3' doesn't exist
drop procedure bug4904|
create table t3 (s1 char character set latin1, s2 char character set latin2)|
drop procedure if exists bug4904|
create procedure bug4904 ()
begin
declare continue handler for sqlstate 'HY000' begin end;
...
...
@@ -1766,6 +1859,7 @@ end|
call bug4904()|
drop procedure bug4904|
drop table t3|
drop procedure if exists bug336|
create procedure bug336(out y int)
begin
declare x int;
...
...
@@ -1779,6 +1873,7 @@ select @y|
5
delete from t1|
drop procedure bug336|
drop procedure if exists bug3157|
create procedure bug3157()
begin
if exists(select * from t1) then
...
...
@@ -1796,6 +1891,7 @@ select @n|
2
delete from t1|
drop procedure bug3157|
drop procedure if exists bug5251|
create procedure bug5251()
begin
end|
...
...
@@ -1807,6 +1903,7 @@ where db='test' and name='bug5251' and created = @c1|
count(*)
1
drop procedure bug5251|
drop procedure if exists bug5251|
create procedure bug5251()
checksum table t1|
call bug5251()|
...
...
@@ -1816,6 +1913,7 @@ call bug5251()|
Table Checksum
test.t1 0
drop procedure bug5251|
drop procedure if exists bug5287|
create procedure bug5287(param1 int)
label1:
begin
...
...
@@ -1828,6 +1926,7 @@ end loop;
end|
call bug5287(1)|
drop procedure bug5287|
drop procedure if exists bug5307|
create procedure bug5307()
begin
end; set @x = 3|
...
...
@@ -1836,9 +1935,11 @@ select @x|
@x
3
drop procedure bug5307|
drop procedure if exists bug5258|
create procedure bug5258()
begin
end|
drop procedure if exists bug5258_aux|
create procedure bug5258_aux()
begin
declare c, m char(19);
...
...
@@ -1854,6 +1955,7 @@ Ok
Ok
drop procedure bug5258|
drop procedure bug5258_aux|
drop function if exists bug4487|
create function bug4487() returns char
begin
declare v char;
...
...
@@ -1864,6 +1966,7 @@ bug4487()
NULL
drop function bug4487|
drop procedure if exists bug4941|
drop procedure if exists bug4941|
create procedure bug4941(out x int)
begin
declare c cursor for select i from t2 limit 1;
...
...
@@ -1880,6 +1983,7 @@ NULL
delete from t1|
drop procedure bug4941|
drop procedure if exists bug3583|
drop procedure if exists bug3583|
create procedure bug3583()
begin
declare c int;
...
...
@@ -1927,6 +2031,7 @@ drop procedure bug3583|
drop table if exists t3|
drop procedure if exists bug4905|
create table t3 (s1 int,primary key (s1))|
drop procedure if exists bug4905|
create procedure bug4905()
begin
declare v int;
...
...
@@ -1951,6 +2056,7 @@ s1
drop procedure bug4905|
drop table t3|
drop function if exists bug6022|
drop function if exists bug6022|
create function bug6022(x int) returns int
begin
if x < 0 then
...
...
@@ -1964,6 +2070,7 @@ bug6022(5)
0
drop function bug6022|
drop procedure if exists bug6029|
drop procedure if exists bug6029|
create procedure bug6029()
begin
declare exit handler for 1136 select '1136';
...
...
@@ -1985,6 +2092,7 @@ drop procedure bug6029|
drop table t3|
drop table if exists fac|
create table fac (n int unsigned not null primary key, f bigint unsigned)|
drop procedure if exists ifac|
create procedure ifac(n int unsigned)
begin
declare i int unsigned default 1;
...
...
@@ -2044,6 +2152,7 @@ insert into primes values
(30, 131), (31, 137), (32, 139), (33, 149), (34, 151),
(35, 157), (36, 163), (37, 167), (38, 173), (39, 179),
(40, 181), (41, 191), (42, 193), (43, 197), (44, 199)|
drop procedure if exists opp|
create procedure opp(n bigint unsigned, out pp bool)
begin
declare r double;
...
...
@@ -2070,6 +2179,7 @@ end;
end if;
end loop;
end|
drop procedure if exists ip|
create procedure ip(m int unsigned)
begin
declare p bigint unsigned;
...
...
@@ -2133,6 +2243,7 @@ Db Name Type Definer Modified Created Security_type Comment
drop table if exists fib|
create table fib ( f bigint unsigned not null )|
insert into fib values (1), (1)|
drop procedure if exists fib|
create procedure fib(n int unsigned)
begin
if n > 0 then
...
...
@@ -2175,6 +2286,7 @@ f
17711
drop table fib|
drop procedure fib|
drop procedure if exists bar|
create procedure bar(x char(16), y int)
comment "111111111111" sql security invoker
insert into test.t1 values (x, y)|
...
...
@@ -2195,6 +2307,7 @@ test bar PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINE
drop procedure bar|
drop table t1;
drop table t2;
drop procedure if exists p1;
create procedure p1 () select (select s1 from t1) from t1;
create table t1 (s1 int);
call p1();
...
...
@@ -2205,6 +2318,7 @@ call p1();
1
drop procedure p1;
drop table t1;
drop function if exists foo;
create function `foo` () returns int return 5;
select `foo` ();
`foo` ()
...
...
mysql-test/t/sp.test
View file @
b17326a3
...
...
@@ -8,36 +8,15 @@
use
test
;
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t3
,
t4
;
drop
procedure
if
exists
goto1
;
drop
procedure
if
exists
goto2
;
drop
procedure
if
exists
goto3
;
drop
procedure
if
exists
goto4
;
drop
procedure
if
exists
goto5
;
drop
procedure
if
exists
goto6
;
drop
procedure
if
exists
into_outfile
;
drop
procedure
if
exists
into_dumpfile
;
drop
procedure
if
exists
create_select
;
drop
procedure
if
exists
bar
;
drop
procedure
if
exists
hndlr1
;
drop
procedure
if
exists
hndlr2
;
drop
procedure
if
exists
hndlr3
;
drop
procedure
if
exists
hndlr4
;
drop
procedure
if
exists
cur1
;
drop
procedure
if
exists
cur2
;
drop
procedure
if
exists
chistics
;
drop
procedure
if
exists
chistics2
;
drop
procedure
if
exists
modes
;
drop
procedure
if
exists
dummy
;
drop
procedure
if
exists
bug
;
drop
procedure
if
exists
bug2
;
drop
function
if
exists
fac
;
drop
table
if
exists
t1
;
--
enable_warnings
create
table
t1
(
id
char
(
16
)
not
null
,
data
int
not
null
);
--
disable_warnings
drop
table
if
exists
t2
;
--
enable_warnings
create
table
t2
(
s
char
(
16
),
i
int
,
...
...
@@ -46,6 +25,9 @@ create table t2 (
# Single statement, no params.
--
disable_warnings
drop
procedure
if
exists
foo42
;
--
enable_warnings
create
procedure
foo42
()
insert
into
test
.
t1
values
(
"foo"
,
42
);
...
...
@@ -56,6 +38,9 @@ drop procedure foo42;
# Single statement, two IN params.
--
disable_warnings
drop
procedure
if
exists
bar
;
--
enable_warnings
create
procedure
bar
(
x
char
(
16
),
y
int
)
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -69,6 +54,9 @@ delete from t1;
delimiter
|
;
# Empty statement
--
disable_warnings
drop
procedure
if
exists
empty
|
--
enable_warnings
create
procedure
empty
()
begin
end
|
...
...
@@ -78,6 +66,9 @@ drop procedure empty|
# Scope test. This is legal (warnings might be possible in the future,
# but for the time being, we just accept it).
--
disable_warnings
drop
procedure
if
exists
scope
|
--
enable_warnings
create
procedure
scope
(
a
int
,
b
float
)
begin
declare
b
int
;
...
...
@@ -91,6 +82,9 @@ end|
drop
procedure
scope
|
# Two statements.
--
disable_warnings
drop
procedure
if
exists
two
|
--
enable_warnings
create
procedure
two
(
x1
char
(
16
),
x2
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x1
,
y
);
...
...
@@ -104,6 +98,9 @@ drop procedure two|
# Simple test of local variables and SET.
--
disable_warnings
drop
procedure
if
exists
locset
|
--
enable_warnings
create
procedure
locset
(
x
char
(
16
),
y
int
)
begin
declare
z1
,
z2
int
;
...
...
@@ -120,6 +117,9 @@ drop procedure locset|
# In some contexts local variables are not recognized
# (and in some, you have to qualify the identifier).
--
disable_warnings
drop
procedure
if
exists
setcontext
|
--
enable_warnings
create
procedure
setcontext
()
begin
declare
data
int
default
2
;
...
...
@@ -136,8 +136,14 @@ drop procedure setcontext|
# Set things to null
--
disable_warnings
drop
table
if
exists
t3
|
--
enable_warnings
create
table
t3
(
d
date
,
i
int
,
f
double
,
s
varchar
(
32
)
)
|
--
disable_warnings
drop
procedure
if
exists
nullset
|
--
enable_warnings
create
procedure
nullset
()
begin
declare
ld
date
;
...
...
@@ -163,6 +169,9 @@ drop procedure nullset|
# The peculiar (non-standard) mixture of variables types in SET.
--
disable_warnings
drop
procedure
if
exists
mixset
|
--
enable_warnings
create
procedure
mixset
(
x
char
(
16
),
y
int
)
begin
declare
z
int
;
...
...
@@ -179,6 +188,9 @@ drop procedure mixset|
# Multiple CALL statements, one with OUT parameter.
--
disable_warnings
drop
procedure
if
exists
zip
|
--
enable_warnings
create
procedure
zip
(
x
char
(
16
),
y
int
)
begin
declare
z
int
;
...
...
@@ -187,6 +199,9 @@ begin
end
|
# SET local variables and OUT parameter.
--
disable_warnings
drop
procedure
if
exists
zap
|
--
enable_warnings
create
procedure
zap
(
x
int
,
out
y
int
)
begin
declare
z
int
;
...
...
@@ -207,12 +222,24 @@ drop procedure zap|
# "Deep" calls...
--
disable_warnings
drop
procedure
if
exists
c1
|
--
enable_warnings
create
procedure
c1
(
x
int
)
call
c2
(
"c"
,
x
)
|
--
disable_warnings
drop
procedure
if
exists
c2
|
--
enable_warnings
create
procedure
c2
(
s
char
(
16
),
x
int
)
call
c3
(
x
,
s
)
|
--
disable_warnings
drop
procedure
if
exists
c3
|
--
enable_warnings
create
procedure
c3
(
x
int
,
s
char
(
16
))
call
c4
(
"level"
,
x
,
s
)
|
--
disable_warnings
drop
procedure
if
exists
c4
|
--
enable_warnings
create
procedure
c4
(
l
char
(
8
),
x
int
,
s
char
(
16
))
insert
into
t1
values
(
concat
(
l
,
s
),
x
)
|
...
...
@@ -225,18 +252,27 @@ drop procedure c3|
drop
procedure
c4
|
# INOUT test
--
disable_warnings
drop
procedure
if
exists
iotest
|
--
enable_warnings
create
procedure
iotest
(
x1
char
(
16
),
x2
char
(
16
),
y
int
)
begin
call
inc2
(
x2
,
y
);
insert
into
test
.
t1
values
(
x1
,
y
);
end
|
--
disable_warnings
drop
procedure
if
exists
inc2
|
--
enable_warnings
create
procedure
inc2
(
x
char
(
16
),
y
int
)
begin
call
inc
(
y
);
insert
into
test
.
t1
values
(
x
,
y
);
end
|
--
disable_warnings
drop
procedure
if
exists
inc
|
--
enable_warnings
create
procedure
inc
(
inout
io
int
)
set
io
=
io
+
1
|
...
...
@@ -247,6 +283,9 @@ drop procedure iotest|
drop
procedure
inc2
|
# Propagating top-level @-vars
--
disable_warnings
drop
procedure
if
exists
incr
|
--
enable_warnings
create
procedure
incr
(
inout
x
int
)
call
inc
(
x
)
|
...
...
@@ -263,6 +302,9 @@ drop procedure incr|
# The expected result is:
# ("cbv2", 4)
# ("cbv1", 4711)
--
disable_warnings
drop
procedure
if
exists
cbv1
|
--
enable_warnings
create
procedure
cbv1
()
begin
declare
y
int
default
3
;
...
...
@@ -271,6 +313,9 @@ begin
insert
into
test
.
t1
values
(
"cbv1"
,
y
);
end
|
--
disable_warnings
drop
procedure
if
exists
cbv2
|
--
enable_warnings
create
procedure
cbv2
(
y1
int
,
inout
y2
int
)
begin
set
y2
=
4711
;
...
...
@@ -288,10 +333,16 @@ drop procedure cbv2|
insert
into
t2
values
(
"a"
,
1
,
1.1
),
(
"b"
,
2
,
1.2
),
(
"c"
,
3
,
1.3
)
|
--
disable_warnings
drop
procedure
if
exists
sub1
|
--
enable_warnings
create
procedure
sub1
(
id
char
(
16
),
x
int
)
insert
into
test
.
t1
values
(
id
,
x
)
|
# QQ This doesn't work yet
#--disable_warnings
#drop procedure if exists sub2|
#--enable_warnings
#create procedure sub2(id char(16))
#begin
# declare x int;
...
...
@@ -299,6 +350,9 @@ create procedure sub1(id char(16), x int)
# insert into test.t1 values (id, x);
#end|
--
disable_warnings
drop
procedure
if
exists
sub3
|
--
enable_warnings
create
function
sub3
(
i
int
)
returns
int
return
i
+
1
|
...
...
@@ -317,6 +371,9 @@ delete from t2|
# Basic tests of the flow control constructs
# Just test on 'x'...
--
disable_warnings
drop
procedure
if
exists
a0
|
--
enable_warnings
create
procedure
a0
(
x
int
)
while
x
do
set
x
=
x
-
1
;
...
...
@@ -330,6 +387,9 @@ drop procedure a0|
# The same, but with a more traditional test.
--
disable_warnings
drop
procedure
if
exists
a
|
--
enable_warnings
create
procedure
a
(
x
int
)
while
x
>
0
do
set
x
=
x
-
1
;
...
...
@@ -343,6 +403,9 @@ drop procedure a|
# REPEAT
--
disable_warnings
drop
procedure
if
exists
b
|
--
enable_warnings
create
procedure
b
(
x
int
)
repeat
insert
into
test
.
t1
values
(
repeat
(
"b"
,
3
),
x
);
...
...
@@ -356,6 +419,9 @@ drop procedure b|
# Check that repeat isn't parsed the wrong way
--
disable_warnings
drop
procedure
if
exists
b2
|
--
enable_warnings
create
procedure
b2
(
x
int
)
repeat
(
select
1
into
outfile
'b2'
);
insert
into
test
.
t1
values
(
repeat
(
"b2"
,
3
),
x
);
...
...
@@ -367,6 +433,9 @@ drop procedure b2|
# Labelled WHILE with ITERATE (pointless really)
--
disable_warnings
drop
procedure
if
exists
c
|
--
enable_warnings
create
procedure
c
(
x
int
)
hmm
:
while
x
>
0
do
insert
into
test
.
t1
values
(
"c"
,
x
);
...
...
@@ -382,6 +451,9 @@ drop procedure c|
# Labelled WHILE with LEAVE
--
disable_warnings
drop
procedure
if
exists
d
|
--
enable_warnings
create
procedure
d
(
x
int
)
hmm
:
while
x
>
0
do
insert
into
test
.
t1
values
(
"d"
,
x
);
...
...
@@ -397,6 +469,9 @@ drop procedure d|
# LOOP, with simple IF statement
--
disable_warnings
drop
procedure
if
exists
e
|
--
enable_warnings
create
procedure
e
(
x
int
)
foo
:
loop
if
x
=
0
then
...
...
@@ -413,6 +488,9 @@ drop procedure e|
# A full IF statement
--
disable_warnings
drop
procedure
if
exists
f
|
--
enable_warnings
create
procedure
f
(
x
int
)
if
x
<
0
then
insert
into
test
.
t1
values
(
"f"
,
0
);
...
...
@@ -431,6 +509,9 @@ drop procedure f|
# This form of CASE is really just syntactic sugar for IF-ELSEIF-...
--
disable_warnings
drop
procedure
if
exists
g
|
--
enable_warnings
create
procedure
g
(
x
int
)
case
when
x
<
0
then
...
...
@@ -450,6 +531,9 @@ drop procedure g|
# The "simple CASE"
--
disable_warnings
drop
procedure
if
exists
h
|
--
enable_warnings
create
procedure
h
(
x
int
)
case
x
when
0
then
...
...
@@ -469,6 +553,9 @@ drop procedure h|
# It's actually possible to LEAVE a BEGIN-END block
--
disable_warnings
drop
procedure
if
exists
i
|
--
enable_warnings
create
procedure
i
(
x
int
)
foo
:
begin
...
...
@@ -490,6 +577,9 @@ drop procedure i|
# QQQ The "label" syntax is temporary, it will (hopefully)
# change to the more common "L:" syntax soon.
#
--
disable_warnings
drop
procedure
if
exists
goto1
|
--
enable_warnings
create
procedure
goto1
()
begin
declare
y
int
;
...
...
@@ -509,6 +599,9 @@ call goto1()|
drop
procedure
goto1
|
# With dummy handlers, just to test restore of contexts with jumps
--
disable_warnings
drop
procedure
if
exists
goto2
|
--
enable_warnings
create
procedure
goto2
(
a
int
)
begin
declare
x
int
default
0
;
...
...
@@ -544,6 +637,9 @@ drop procedure goto2|
delete
from
t1
|
# Check label visibility for some more cases. We don't call these.
--
disable_warnings
drop
procedure
if
exists
goto3
|
--
enable_warnings
create
procedure
goto3
()
begin
label
L1
;
...
...
@@ -553,6 +649,9 @@ begin
end
|
drop
procedure
goto3
|
--
disable_warnings
drop
procedure
if
exists
goto4
|
--
enable_warnings
create
procedure
goto4
()
begin
begin
...
...
@@ -564,6 +663,9 @@ begin
end
|
drop
procedure
goto4
|
--
disable_warnings
drop
procedure
if
exists
goto5
|
--
enable_warnings
create
procedure
goto5
()
begin
begin
...
...
@@ -575,6 +677,9 @@ begin
end
|
drop
procedure
goto5
|
--
disable_warnings
drop
procedure
if
exists
goto6
|
--
enable_warnings
create
procedure
goto6
()
begin
label
L1
;
...
...
@@ -604,6 +709,9 @@ drop procedure goto6|
insert
into
t1
values
(
"foo"
,
3
),
(
"bar"
,
19
)
|
insert
into
t2
values
(
"x"
,
9
,
4.1
),
(
"y"
,
-
1
,
19.2
),
(
"z"
,
3
,
2.2
)
|
--
disable_warnings
drop
procedure
if
exists
sel1
|
--
enable_warnings
create
procedure
sel1
()
begin
select
*
from
t1
;
...
...
@@ -612,6 +720,9 @@ end|
call
sel1
()
|
drop
procedure
sel1
|
--
disable_warnings
drop
procedure
if
exists
sel2
|
--
enable_warnings
create
procedure
sel2
()
begin
select
*
from
t1
;
...
...
@@ -624,6 +735,9 @@ delete from t1|
delete
from
t2
|
# SELECT INTO local variables
--
disable_warnings
drop
procedure
if
exists
into_test
|
--
enable_warnings
create
procedure
into_test
(
x
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -638,6 +752,9 @@ drop procedure into_test|
# SELECT INTO with a mix of local and global variables
--
disable_warnings
drop
procedure
if
exists
into_tes2
|
--
enable_warnings
create
procedure
into_test2
(
x
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -652,6 +769,9 @@ drop procedure into_test2|
# SELECT * INTO ... (bug test)
--
disable_warnings
drop
procedure
if
exists
into_test3
|
--
enable_warnings
create
procedure
into_test3
()
begin
declare
x
char
(
16
);
...
...
@@ -673,6 +793,9 @@ drop procedure into_test3|
# SELECT INTO with no data is a warning ("no data", which we will
# not see normally). When not caught, execution proceeds.
--
disable_warnings
drop
procedure
if
exists
into_test4
|
--
enable_warnings
create
procedure
into_test4
()
begin
declare
x
int
;
...
...
@@ -698,7 +821,9 @@ drop procedure into_test4|
# These two (and the two procedures above) caused an assert() to fail in
# sql_base.cc:lock_tables() at some point.
--
disable_warnings
drop
procedure
if
exists
into_outfile
|
--
enable_warnings
create
procedure
into_outfile
(
x
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -712,6 +837,9 @@ system rm -f /tmp/spout|
delete
from
t1
|
drop
procedure
into_outfile
|
--
disable_warnings
drop
procedure
if
exists
into_dumpfile
|
--
enable_warnings
create
procedure
into_dumpfile
(
x
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -725,7 +853,9 @@ system rm -f /tmp/spdump|
delete
from
t1
|
drop
procedure
into_dumpfile
|
--
disable_warnings
drop
procedure
if
exists
create_select
|
--
enable_warnings
create
procedure
create_select
(
x
char
(
16
),
y
int
)
begin
insert
into
test
.
t1
values
(
x
,
y
);
...
...
@@ -746,6 +876,9 @@ drop procedure create_select|
# A minimal, constant FUNCTION.
--
disable_warnings
drop
function
if
exists
e
|
--
enable_warnings
create
function
e
()
returns
double
return
2.7182818284590452354
|
...
...
@@ -753,24 +886,36 @@ set @e = e()|
select
e
(),
@
e
|
# A minimal function with one argument
--
disable_warnings
drop
function
if
exists
inc
|
--
enable_warnings
create
function
inc
(
i
int
)
returns
int
return
i
+
1
|
select
inc
(
1
),
inc
(
99
),
inc
(
-
71
)
|
# A minimal function with two arguments
--
disable_warnings
drop
function
if
exists
mul
|
--
enable_warnings
create
function
mul
(
x
int
,
y
int
)
returns
int
return
x
*
y
|
select
mul
(
1
,
1
),
mul
(
3
,
5
),
mul
(
4711
,
666
)
|
# A minimal string function
--
disable_warnings
drop
function
if
exists
append
|
--
enable_warnings
create
function
append
(
s1
char
(
8
),
s2
char
(
8
))
returns
char
(
16
)
return
concat
(
s1
,
s2
)
|
select
append
(
"foo"
,
"bar"
)
|
# A function with flow control
--
disable_warnings
drop
function
if
exists
fac
|
--
enable_warnings
create
function
fac
(
n
int
unsigned
)
returns
bigint
unsigned
begin
declare
f
bigint
unsigned
default
1
;
...
...
@@ -785,6 +930,9 @@ end|
select
fac
(
1
),
fac
(
2
),
fac
(
5
),
fac
(
10
)
|
# Nested calls
--
disable_warnings
drop
function
if
exists
fun
|
--
enable_warnings
create
function
fun
(
d
double
,
i
int
,
u
int
unsigned
)
returns
double
return
mul
(
inc
(
i
),
fac
(
u
))
/
e
()
|
...
...
@@ -814,6 +962,9 @@ drop function fun|
# CONDITIONs and HANDLERs
#
--
disable_warnings
drop
procedure
if
exists
hndlr1
|
--
enable_warnings
create
procedure
hndlr1
(
val
int
)
begin
declare
x
int
default
0
;
...
...
@@ -833,6 +984,9 @@ select * from t1|
delete
from
t1
|
drop
procedure
hndlr1
|
--
disable_warnings
drop
procedure
if
exists
hndlr2
|
--
enable_warnings
create
procedure
hndlr2
(
val
int
)
begin
declare
x
int
default
0
;
...
...
@@ -852,6 +1006,9 @@ delete from t1|
drop
procedure
hndlr2
|
--
disable_warnings
drop
procedure
if
exists
hndlr3
|
--
enable_warnings
create
procedure
hndlr3
(
val
int
)
begin
declare
x
int
default
0
;
...
...
@@ -890,6 +1047,9 @@ drop table if exists t3|
--
enable_warnings
create
table
t3
(
id
char
(
16
),
data
int
)
|
--
disable_warnings
drop
procedure
if
exists
hndlr4
|
--
enable_warnings
create
procedure
hndlr4
()
begin
declare
x
int
default
0
;
...
...
@@ -910,6 +1070,9 @@ drop procedure hndlr4|
#
# Cursors
#
--
disable_warnings
drop
procedure
if
exists
cur1
|
--
enable_warnings
create
procedure
cur1
()
begin
declare
a
char
(
16
);
...
...
@@ -939,6 +1102,9 @@ drop table if exists t3|
--
enable_warnings
create
table
t3
(
s
char
(
16
),
i
int
)
|
--
disable_warnings
drop
procedure
if
exists
cur2
|
--
enable_warnings
create
procedure
cur2
()
begin
declare
done
int
default
0
;
...
...
@@ -977,6 +1143,9 @@ drop procedure cur2|
# The few characteristics we parse
--
disable_warnings
drop
procedure
if
exists
chistics
|
--
enable_warnings
create
procedure
chistics
()
language
sql
modifies
sql
data
...
...
@@ -994,6 +1163,9 @@ alter procedure chistics sql security invoker|
show
create
procedure
chistics
|
drop
procedure
chistics
|
--
disable_warnings
drop
function
if
exists
chistics
|
--
enable_warnings
create
function
chistics
()
returns
int
language
sql
deterministic
...
...
@@ -1016,6 +1188,9 @@ insert into t1 values ("foo", 1), ("bar", 2), ("zip", 3)|
set
@@
sql_mode
=
'ANSI'
|
delimiter
$
|
--
disable_warnings
drop
procedure
if
exists
modes
$
--
enable_warnings
create
procedure
modes
(
out
c1
int
,
out
c2
int
)
begin
declare
done
int
default
0
;
...
...
@@ -1064,6 +1239,9 @@ drop database sp_db2|
# And yet again, with just a procedure.
create database sp_db3|
use sp_db3|
--disable_warnings
drop procedure if exists dummy|
--enable_warnings
create procedure dummy(out x int)
set x = 42|
use test|
...
...
@@ -1074,6 +1252,9 @@ select type,db,name from mysql.proc where db = 'sp_db3'|
# ROW_COUNT() function after a CALL
# We test the other cases here too, although it's not strictly SP specific
--disable_warnings
drop procedure if exists rc|
--enable_warnings
create procedure rc()
begin
delete from t1
;
...
...
@@ -1100,7 +1281,10 @@ drop procedure rc|
#
# BUG#822
#
create
procedure
bug
(
a_id
char
(
16
),
a_data
int
)
--
disable_warnings
drop
procedure
if
exists
bug822
|
--
enable_warnings
create
procedure
bug822
(
a_id
char
(
16
),
a_data
int
)
begin
declare
n
int
;
select
count
(
*
)
into
n
from
t1
where
id
=
a_id
and
data
=
a_data
;
...
...
@@ -1109,17 +1293,20 @@ begin
end
if
;
end
|
call
bug
(
'foo'
,
42
)
|
call
bug
(
'foo'
,
42
)
|
call
bug
(
'bar'
,
666
)
|
call
bug
822
(
'foo'
,
42
)
|
call
bug
822
(
'foo'
,
42
)
|
call
bug
822
(
'bar'
,
666
)
|
select
*
from
t1
|
delete
from
t1
|
drop
procedure
bug
|
drop
procedure
bug
822
|
#
# BUG#1495
#
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug1495
|
--
enable_warnings
create
procedure
bug1495
()
begin
declare
x
int
;
...
...
@@ -1132,19 +1319,22 @@ begin
end
|
insert
into
t1
values
(
'foo'
,
12
)
|
call
bug
()
|
call
bug
1495
()
|
delete
from
t1
where
id
=
'foo'
|
insert
into
t1
values
(
'bar'
,
7
)
|
call
bug
()
|
call
bug
1495
()
|
delete
from
t1
where
id
=
'bar'
|
select
*
from
t1
|
delete
from
t1
|
drop
procedure
bug
|
drop
procedure
bug
1495
|
#
# BUG#1547
#
create
procedure
bug
(
s
char
(
16
))
--
disable_warnings
drop
procedure
if
exists
bug1547
|
--
enable_warnings
create
procedure
bug1547
(
s
char
(
16
))
begin
declare
x
int
;
...
...
@@ -1157,11 +1347,11 @@ begin
end
|
insert
into
t1
values
(
"foo"
,
12
),
(
"bar"
,
7
)
|
call
bug
(
"foo"
)
|
call
bug
(
"bar"
)
|
call
bug
1547
(
"foo"
)
|
call
bug
1547
(
"bar"
)
|
select
*
from
t1
|
delete
from
t1
|
drop
procedure
bug
|
drop
procedure
bug
1547
|
#
# BUG#1656
...
...
@@ -1172,13 +1362,16 @@ drop table if exists t70|
create
table
t70
(
s1
int
,
s2
int
)
|
insert
into
t70
values
(
1
,
2
)
|
create
procedure
bug
(
out
p1
int
,
out
p2
int
)
--
disable_warnings
drop
procedure
if
exists
bug1656
|
--
enable_warnings
create
procedure
bug1656
(
out
p1
int
,
out
p2
int
)
select
*
into
p1
,
p1
from
t70
|
call
bug
(
@
1
,
@
2
)
|
call
bug
1656
(
@
1
,
@
2
)
|
select
@
1
,
@
2
|
drop
table
t70
|
drop
procedure
bug
|
drop
procedure
bug
1656
|
#
# BUG#1862
...
...
@@ -1188,23 +1381,29 @@ drop table if exists t3|
--
enable_warnings
create
table
t3
(
a
int
)
|
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug1862
|
--
enable_warnings
create
procedure
bug1862
()
begin
insert
into
t3
values
(
2
);
flush
tables
;
end
|
call
bug
()
|
call
bug
1862
()
|
# the second call caused a segmentation
call
bug
()
|
call
bug
1862
()
|
select
*
from
t3
|
drop
table
t3
|
drop
procedure
bug
|
drop
procedure
bug
1862
|
#
# BUG#1874
#
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug1874
|
--
enable_warnings
create
procedure
bug1874
()
begin
declare
x
int
;
declare
y
double
;
...
...
@@ -1219,16 +1418,19 @@ begin
end
|
insert
into
t1
(
data
)
values
(
3
),
(
1
),
(
5
),
(
9
),
(
4
)
|
call
bug
()
|
call
bug
1874
()
|
select
*
from
t2
|
delete
from
t1
|
delete
from
t2
|
drop
procedure
bug
|
drop
procedure
bug
1874
|
#
# BUG#2260
#
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug2260
|
--
enable_warnings
create
procedure
bug2260
()
begin
declare
v1
int
;
declare
c1
cursor
for
select
data
from
t1
;
...
...
@@ -1240,28 +1442,40 @@ begin
close
c1
;
end
|
call
bug
()
|
call
bug
2260
()
|
select
@
x2
|
drop
procedure
bug
|
drop
procedure
bug
2260
|
#
# BUG#2267
#
--
disable_warnings
drop
procedure
if
exists
bug2267_1
|
--
enable_warnings
create
procedure
bug2267_1
()
begin
show
procedure
status
;
end
|
--
disable_warnings
drop
procedure
if
exists
bug2267_2
|
--
enable_warnings
create
procedure
bug2267_2
()
begin
show
function
status
;
end
|
--
disable_warnings
drop
procedure
if
exists
bug2267_3
|
--
enable_warnings
create
procedure
bug2267_3
()
begin
show
create
procedure
bug2267_1
;
end
|
--
disable_warnings
drop
procedure
if
exists
bug2267_4
|
--
enable_warnings
create
procedure
bug2267_4
()
begin
show
create
function
fac
;
...
...
@@ -1282,7 +1496,10 @@ drop procedure bug2267_4|
#
# BUG#2227
#
create
procedure
bug
(
x
int
)
--
disable_warnings
drop
procedure
if
exists
bug2227
|
--
enable_warnings
create
procedure
bug2227
(
x
int
)
begin
declare
y
float
default
2.6
;
declare
z
char
(
16
)
default
"zzz"
;
...
...
@@ -1290,13 +1507,16 @@ begin
select
1.3
,
x
,
y
,
42
,
z
;
end
|
call
bug
(
9
)
|
drop
procedure
bug
|
call
bug
2227
(
9
)
|
drop
procedure
bug
2227
|
#
# BUG#2614
#
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug2614
|
--
enable_warnings
create
procedure
bug2614
()
begin
drop
table
if
exists
t3
;
create
table
t3
(
id
int
default
'0'
not
null
);
...
...
@@ -1305,29 +1525,41 @@ begin
end
|
--
disable_warnings
call
bug
()
|
call
bug
2614
()
|
--
enable_warnings
call
bug
()
|
call
bug
2614
()
|
drop
table
t3
|
drop
procedure
bug
|
drop
procedure
bug
2614
|
#
# BUG#2674
#
create
function
bug
()
returns
int
--
disable_warnings
drop
function
if
exists
bug2674
|
--
enable_warnings
create
function
bug2674
()
returns
int
return
@@
sort_buffer_size
|
set
@
osbs
=
@@
sort_buffer_size
|
set
@@
sort_buffer_size
=
262000
|
select
bug
()
|
drop
function
bug
|
select
bug
2674
()
|
drop
function
bug
2674
|
set
@@
sort_buffer_size
=
@
osbs
|
#
# BUG#3259
#
--
disable_warnings
drop
procedure
if
exists
bug3259_1
|
--
enable_warnings
create
procedure
bug3259_1
()
begin
end
|
--
disable_warnings
drop
procedure
if
exists
BUG3259_2
|
--
enable_warnings
create
procedure
BUG3259_2
()
begin
end
|
--
disable_warnings
drop
procedure
if
exists
Bug3259_3
|
--
enable_warnings
create
procedure
Bug3259_3
()
begin
end
|
call
BUG3259_1
()
|
...
...
@@ -1342,18 +1574,24 @@ drop procedure BuG3259_2|
drop
procedure
BUG3259_3
|
#
# BUG#
#
2772
# BUG#2772
#
create
function
bug
()
returns
char
(
10
)
character
set
latin2
--
disable_warnings
drop
function
if
exists
bug2772
|
--
enable_warnings
create
function
bug2772
()
returns
char
(
10
)
character
set
latin2
return
'a'
|
select
bug
()
|
drop
function
bug
|
select
bug
2772
()
|
drop
function
bug
2772
|
#
# BUG#2776
#
create
procedure
bug
(
out
x
int
)
--
disable_warnings
drop
procedure
if
exists
bug2776_1
|
--
enable_warnings
create
procedure
bug2776_1
(
out
x
int
)
begin
declare
v
int
;
...
...
@@ -1361,7 +1599,10 @@ begin
set
x
=
v
;
end
|
create
procedure
bug2
(
out
x
int
)
--
disable_warnings
drop
procedure
if
exists
bug2776_2
|
--
enable_warnings
create
procedure
bug2776_2
(
out
x
int
)
begin
declare
v
int
default
42
;
...
...
@@ -1370,12 +1611,12 @@ begin
end
|
set
@
x
=
1
|
call
bug
(
@
x
)
|
call
bug
2776_1
(
@
x
)
|
select
@
x
|
call
bug2
(
@
x
)
|
call
bug2
776_2
(
@
x
)
|
select
@
x
|
drop
procedure
bug
|
drop
procedure
bug2
|
drop
procedure
bug
2776_1
|
drop
procedure
bug2
776_2
|
#
# BUG#2780
...
...
@@ -1387,7 +1628,10 @@ create table t3 (s1 smallint)|
insert
into
t3
values
(
123456789012
)
|
create
procedure
bug
()
--
disable_warnings
drop
procedure
if
exists
bug2780
|
--
enable_warnings
create
procedure
bug2780
()
begin
declare
exit
handler
for
sqlwarning
set
@
x
=
1
;
...
...
@@ -1396,11 +1640,11 @@ begin
insert
into
t3
values
(
0
);
end
|
call
bug
()
|
call
bug
2780
()
|
select
@
x
|
select
*
from
t3
|
drop
procedure
bug
|
drop
procedure
bug
2780
|
drop
table
t3
|
#
...
...
@@ -1411,6 +1655,9 @@ insert into t3 values ("test1")|
insert
into
t3
values
(
"test2"
)
|
create
table
t4
(
f1
int
,
rc
int
,
t3
int
)
|
--
disable_warnings
drop
procedure
if
exists
bug1863
|
--
enable_warnings
create
procedure
bug1863
(
in1
int
)
begin
...
...
@@ -1471,6 +1718,9 @@ insert t3 (OrderID,MarketID) values (2,2)|
insert
t4
(
MarketID
,
Market
,
Status
)
values
(
1
,
"MarketID One"
,
"A"
)
|
insert
t4
(
MarketID
,
Market
,
Status
)
values
(
2
,
"MarketID Two"
,
"A"
)
|
--
disable_warnings
drop
procedure
if
exists
bug2656_1
|
--
enable_warnings
create
procedure
bug2656_1
()
begin
select
...
...
@@ -1479,6 +1729,9 @@ begin
ON
o
.
MarketID
!=
1
and
o
.
MarketID
=
m
.
MarketID
;
end
|
--
disable_warnings
drop
procedure
if
exists
bug2656_2
|
--
enable_warnings
create
procedure
bug2656_2
()
begin
select
...
...
@@ -1502,6 +1755,9 @@ drop table t3, t4|
#
# BUG#3426
#
--
disable_warnings
drop
procedure
if
exists
bug3426
|
--
enable_warnings
create
procedure
bug3426
(
in_time
int
unsigned
,
out
x
int
)
begin
if
in_time
is
null
then
...
...
@@ -1546,6 +1802,9 @@ create table t4 (
insert
into
t3
values
(
1
,
'aCh1'
)
,
(
'2'
,
'aCh2'
)
|
insert
into
t4
values
(
1
,
'bCh1'
)
|
--
disable_warnings
drop
procedure
if
exists
bug3448
|
--
enable_warnings
create
procedure
bug3448
()
select
*
from
t3
inner
join
t4
on
t3
.
a
=
t4
.
b
|
...
...
@@ -1578,6 +1837,9 @@ insert into t3 (title,body) values
(
'MySQL vs. YourSQL'
,
'In the following database comparison ...'
),
(
'MySQL Security'
,
'When configured properly, MySQL ...'
)
|
--
disable_warnings
drop
procedure
if
exists
bug3734
|
--
enable_warnings
create
procedure
bug3734
(
param1
varchar
(
100
))
select
*
from
t3
where
match
(
title
,
body
)
against
(
param1
)
|
...
...
@@ -1590,6 +1852,9 @@ drop table t3|
#
# BUG#3863
#
--
disable_warnings
drop
procedure
if
exists
bug3863
|
--
enable_warnings
create
procedure
bug3863
()
begin
set
@
a
=
0
;
...
...
@@ -1617,6 +1882,9 @@ create table t3 (
unique
key
rid
(
rid
,
id
)
)
|
--
disable_warnings
drop
procedure
if
exists
bug2460_1
|
--
enable_warnings
create
procedure
bug2460_1
(
in
v
int
)
begin
(
select
n0
.
id
from
t3
as
n0
where
n0
.
id
=
v
)
...
...
@@ -1634,6 +1902,9 @@ insert into t3 values (1, 1, 'foo'), (2, 1, 'bar'), (3, 1, 'zip zap')|
call
bug2460_1
(
2
)
|
call
bug2460_1
(
2
)
|
--
disable_warnings
drop
procedure
if
exists
bug2460_2
|
--
enable_warnings
create
procedure
bug2460_2
()
begin
drop
table
if
exists
t3
;
...
...
@@ -1654,20 +1925,32 @@ drop table t3|
# BUG#2564
#
set
@@
sql_mode
=
''
|
--
disable_warnings
drop
procedure
if
exists
bug2564_1
|
--
enable_warnings
create
procedure
bug2564_1
()
comment
'Joe''s procedure'
insert
into
`t1`
values
(
"foo"
,
1
)
|
set
@@
sql_mode
=
'ANSI_QUOTES'
|
--
disable_warnings
drop
procedure
if
exists
bug2564_2
|
--
enable_warnings
create
procedure
bug2564_2
()
insert
into
"t1"
values
(
'foo'
,
1
)
|
delimiter
$
|
set
@@
sql_mode
=
''
$
--
disable_warnings
drop
function
if
exists
bug2564_3
$
--
enable_warnings
create
function
bug2564_3
(
x
int
,
y
int
)
returns
int
return
x
||
y
$
set
@@
sql_mode
=
'ANSI'
$
--
disable_warnings
drop
function
if
exists
bug2564_4
$
--
enable_warnings
create
function
bug2564_4
(
x
int
,
y
int
)
returns
int
return
x
||
y
$
delimiter
|
$
...
...
@@ -1686,6 +1969,9 @@ drop function bug2564_4|
#
# BUG#3132
#
--
disable_warnings
drop
function
if
exists
bug3132
|
--
enable_warnings
create
function
bug3132
(
s
char
(
20
))
returns
char
(
50
)
return
concat
(
'Hello, '
,
s
,
'!'
)
|
...
...
@@ -1695,6 +1981,9 @@ drop function bug3132|
#
# BUG#3843
#
--
disable_warnings
drop
procedure
if
exists
bug3843
|
--
enable_warnings
create
procedure
bug3843
()
analyze
table
t1
|
...
...
@@ -1714,6 +2003,9 @@ drop table if exists t3|
create
table
t3
(
s1
char
(
10
)
)
|
insert
into
t3
values
(
'a'
),
(
'b'
)
|
--
disable_warnings
drop
procedure
if
exists
bug3368
|
--
enable_warnings
create
procedure
bug3368
(
v
char
(
10
))
begin
select
group_concat
(
v
)
from
t3
;
...
...
@@ -1733,6 +2025,9 @@ drop table if exists t3|
create
table
t3
(
f1
int
,
f2
int
);
insert
into
t3
values
(
1
,
1
);
--
disable_warnings
drop
procedure
if
exists
bug4579_1
|
--
enable_warnings
create
procedure
bug4579_1
()
begin
declare
sf1
int
;
...
...
@@ -1742,6 +2037,9 @@ begin
call
bug4579_2
();
end
|
--
disable_warnings
drop
procedure
if
exists
bug4579_2
|
--
enable_warnings
create
procedure
bug4579_2
()
begin
end
|
...
...
@@ -1765,6 +2063,9 @@ drop table if exists t3|
create
table
t3
(
f1
int
,
f2
int
,
f3
int
)
|
insert
into
t3
values
(
1
,
1
,
1
)
|
--
disable_warnings
drop
procedure
if
exists
bug4726
|
--
enable_warnings
create
procedure
bug4726
()
begin
declare
tmp_o_id
INT
;
...
...
@@ -1795,6 +2096,9 @@ drop table if exists t3|
create
table
t3
(
s1
int
)
|
insert
into
t3
values
(
3
),
(
4
)
|
--
disable_warnings
drop
procedure
if
exists
bug4318
|
--
enable_warnings
create
procedure
bug4318
()
handler
t3
read
next
|
...
...
@@ -1818,6 +2122,9 @@ drop table t3|
# It's possible that some of these are not deterministic across
# platforms. If so, just remove the offending command.
#
--
disable_warnings
drop
procedure
if
exists
bug4902
|
--
enable_warnings
create
procedure
bug4902
()
begin
show
charset
like
'foo'
;
...
...
@@ -1849,6 +2156,9 @@ call bug4902()|
drop
procedure
bug4902
|
# We need separate SP for SHOW PROCESSLIST since we want use replace_column
--
disable_warnings
drop
procedure
if
exists
bug4902_2
|
--
enable_warnings
create
procedure
bug4902_2
()
begin
show
processlist
;
...
...
@@ -1866,6 +2176,9 @@ drop procedure bug4902_2|
drop
table
if
exists
t3
|
--
enable_warnings
--
disable_warnings
drop
procedure
if
exists
bug4904
|
--
enable_warnings
create
procedure
bug4904
()
begin
declare
continue
handler
for
sqlstate
'HY000'
begin
end
;
...
...
@@ -1880,6 +2193,9 @@ drop procedure bug4904|
create
table
t3
(
s1
char
character
set
latin1
,
s2
char
character
set
latin2
)
|
--
disable_warnings
drop
procedure
if
exists
bug4904
|
--
enable_warnings
create
procedure
bug4904
()
begin
declare
continue
handler
for
sqlstate
'HY000'
begin
end
;
...
...
@@ -1895,6 +2211,9 @@ drop table t3|
#
# BUG#336
#
--
disable_warnings
drop
procedure
if
exists
bug336
|
--
enable_warnings
create
procedure
bug336
(
out
y
int
)
begin
declare
x
int
;
...
...
@@ -1911,6 +2230,9 @@ drop procedure bug336|
#
# BUG#3157
#
--
disable_warnings
drop
procedure
if
exists
bug3157
|
--
enable_warnings
create
procedure
bug3157
()
begin
if
exists
(
select
*
from
t1
)
then
...
...
@@ -1931,6 +2253,9 @@ drop procedure bug3157|
#
# BUG#5251: mysql changes creation time of a procedure/function when altering
#
--
disable_warnings
drop
procedure
if
exists
bug5251
|
--
enable_warnings
create
procedure
bug5251
()
begin
end
|
...
...
@@ -1947,6 +2272,9 @@ drop procedure bug5251|
#
# BUG#5279: Stored procedure packets out of order if CHECKSUM TABLE
#
--
disable_warnings
drop
procedure
if
exists
bug5251
|
--
enable_warnings
create
procedure
bug5251
()
checksum
table
t1
|
...
...
@@ -1957,6 +2285,9 @@ drop procedure bug5251|
#
# BUG#5287: Stored procedure crash if leave outside loop
#
--
disable_warnings
drop
procedure
if
exists
bug5287
|
--
enable_warnings
create
procedure
bug5287
(
param1
int
)
label1
:
begin
...
...
@@ -1975,6 +2306,9 @@ drop procedure bug5287|
#
# BUG#5307: Stored procedure allows statement after BEGIN ... END
#
--
disable_warnings
drop
procedure
if
exists
bug5307
|
--
enable_warnings
create
procedure
bug5307
()
begin
end
;
set
@
x
=
3
|
...
...
@@ -1986,10 +2320,16 @@ drop procedure bug5307|
#
# BUG#5258: Stored procedure modified date is 0000-00-00
# (This was a design flaw)
--
disable_warnings
drop
procedure
if
exists
bug5258
|
--
enable_warnings
create
procedure
bug5258
()
begin
end
|
--
disable_warnings
drop
procedure
if
exists
bug5258_aux
|
--
enable_warnings
create
procedure
bug5258_aux
()
begin
declare
c
,
m
char
(
19
);
...
...
@@ -2010,6 +2350,9 @@ drop procedure bug5258_aux|
#
# BUG#4487: Stored procedure connection aborted if uninitialized char
#
--
disable_warnings
drop
function
if
exists
bug4487
|
--
enable_warnings
create
function
bug4487
()
returns
char
begin
declare
v
char
;
...
...
@@ -2026,6 +2369,9 @@ drop function bug4487|
--
disable_warnings
drop
procedure
if
exists
bug4941
|
--
enable_warnings
--
disable_warnings
drop
procedure
if
exists
bug4941
|
--
enable_warnings
create
procedure
bug4941
(
out
x
int
)
begin
declare
c
cursor
for
select
i
from
t2
limit
1
;
...
...
@@ -2048,6 +2394,9 @@ drop procedure bug4941|
--
disable_warnings
drop
procedure
if
exists
bug3583
|
--
enable_warnings
--
disable_warnings
drop
procedure
if
exists
bug3583
|
--
enable_warnings
create
procedure
bug3583
()
begin
declare
c
int
;
...
...
@@ -2086,6 +2435,9 @@ drop procedure if exists bug4905|
create
table
t3
(
s1
int
,
primary
key
(
s1
))
|
--
disable_warnings
drop
procedure
if
exists
bug4905
|
--
enable_warnings
create
procedure
bug4905
()
begin
declare
v
int
;
...
...
@@ -2112,6 +2464,9 @@ drop table t3|
drop
function
if
exists
bug6022
|
--
enable_warnings
--
disable_warnings
drop
function
if
exists
bug6022
|
--
enable_warnings
create
function
bug6022
(
x
int
)
returns
int
begin
if
x
<
0
then
...
...
@@ -2131,6 +2486,9 @@ drop function bug6022|
drop
procedure
if
exists
bug6029
|
--
enable_warnings
--
disable_warnings
drop
procedure
if
exists
bug6029
|
--
enable_warnings
create
procedure
bug6029
()
begin
declare
exit
handler
for
1136
select
'1136'
;
...
...
@@ -2162,6 +2520,9 @@ drop table if exists fac|
--
enable_warnings
create
table
fac
(
n
int
unsigned
not
null
primary
key
,
f
bigint
unsigned
)
|
--
disable_warnings
drop
procedure
if
exists
ifac
|
--
enable_warnings
create
procedure
ifac
(
n
int
unsigned
)
begin
declare
i
int
unsigned
default
1
;
...
...
@@ -2210,6 +2571,9 @@ insert into primes values
(
35
,
157
),
(
36
,
163
),
(
37
,
167
),
(
38
,
173
),
(
39
,
179
),
(
40
,
181
),
(
41
,
191
),
(
42
,
193
),
(
43
,
197
),
(
44
,
199
)
|
--
disable_warnings
drop
procedure
if
exists
opp
|
--
enable_warnings
create
procedure
opp
(
n
bigint
unsigned
,
out
pp
bool
)
begin
declare
r
double
;
...
...
@@ -2240,6 +2604,9 @@ begin
end
loop
;
end
|
--
disable_warnings
drop
procedure
if
exists
ip
|
--
enable_warnings
create
procedure
ip
(
m
int
unsigned
)
begin
declare
p
bigint
unsigned
;
...
...
@@ -2295,6 +2662,9 @@ insert into fib values (1), (1)|
# We deliberately do it the awkward way, fetching the last two
# values from the table, in order to exercise various statements
# and table accesses at each turn.
--
disable_warnings
drop
procedure
if
exists
fib
|
--
enable_warnings
create
procedure
fib
(
n
int
unsigned
)
begin
if
n
>
0
then
...
...
@@ -2323,6 +2693,9 @@ drop procedure fib|
# Comment & suid
#
--
disable_warnings
drop
procedure
if
exists
bar
|
--
enable_warnings
create
procedure
bar
(
x
char
(
16
),
y
int
)
comment
"111111111111"
sql
security
invoker
insert
into
test
.
t1
values
(
x
,
y
)
|
...
...
@@ -2342,6 +2715,9 @@ drop table t2;
#
# rexecution
#
--
disable_warnings
drop
procedure
if
exists
p1
;
--
enable_warnings
create
procedure
p1
()
select
(
select
s1
from
t1
)
from
t1
;
create
table
t1
(
s1
int
);
call
p1
();
...
...
@@ -2353,6 +2729,9 @@ drop table t1;
#
# backticks
#
--
disable_warnings
drop
function
if
exists
foo
;
--
enable_warnings
create
function
`
foo
` () returns int return 5;
select `
foo
` ();
drop function `
foo
`
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment