Commit b17326a3 authored by pem@mysql.comhem.se's avatar pem@mysql.comhem.se

Reverted previous name changes of all bug tests in sp.test, but kept the

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