Commit 06887bc3 authored by unknown's avatar unknown

Enabled back bunch of tests for stored routines which were disabled

earlier because of various features/checks missing (these features/checks
are now implemented).


mysql-test/r/sp.result:
  Enabled back bunch of tests which were previously disabled because of various
  features/checks missing (since these features/checks are now implemented).
mysql-test/t/sp.test:
  Enabled back bunch of tests which were previously disabled because of various
  features/checks missing (since these features/checks are now implemented).
parent 8fc4efe6
...@@ -988,6 +988,10 @@ end| ...@@ -988,6 +988,10 @@ end|
select f5(1)| select f5(1)|
f5(1) f5(1)
1 1
select f5(2)|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select f5(3)|
ERROR HY000: Recursive stored functions and triggers are not allowed.
create function f6() returns int create function f6() returns int
begin begin
declare n int; declare n int;
...@@ -1035,6 +1039,12 @@ select * from v1| ...@@ -1035,6 +1039,12 @@ select * from v1|
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
create function f1() returns int create function f1() returns int
return (select sum(data) from t1) + (select sum(data) from v1)| return (select sum(data) from t1) + (select sum(data) from v1)|
select f1()|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select * from v1|
ERROR HY000: Recursive stored functions and triggers are not allowed.
select * from v2|
ERROR HY000: Recursive stored functions and triggers are not allowed.
drop function f1| drop function f1|
create function f1() returns int create function f1() returns int
return (select sum(data) from t1)| return (select sum(data) from t1)|
...@@ -1053,7 +1063,7 @@ f0() ...@@ -1053,7 +1063,7 @@ f0()
select *, f0() from v0| select *, f0() from v0|
f0() f0() f0() f0()
100 100 100 100
lock tables t1 read, t1 as t11 read, mysql.proc read| lock tables t1 read, t1 as t11 read|
select f3()| select f3()|
f3() f3()
1 1
...@@ -1251,6 +1261,62 @@ drop procedure opp| ...@@ -1251,6 +1261,62 @@ drop procedure opp|
drop procedure ip| drop procedure ip|
show procedure status like '%p%'| show procedure status like '%p%'|
Db Name Type Definer Modified Created Security_type Comment Db Name Type Definer Modified Created Security_type Comment
drop table if exists fib|
create table fib ( f bigint unsigned not null )|
drop procedure if exists fib|
create procedure fib(n int unsigned)
begin
if n > 1 then
begin
declare x, y bigint unsigned;
declare c cursor for select f from fib order by f desc limit 2;
open c;
fetch c into y;
fetch c into x;
close c;
insert into fib values (x+y);
call fib(n-1);
end;
end if;
end|
set @@max_sp_recursion_depth= 20|
insert into fib values (0), (1)|
call fib(3)|
select * from fib order by f asc|
f
0
1
1
2
delete from fib|
insert into fib values (0), (1)|
call fib(20)|
select * from fib order by f asc|
f
0
1
1
2
3
5
8
13
21
34
55
89
144
233
377
610
987
1597
2584
4181
6765
drop table fib|
drop procedure fib|
set @@max_sp_recursion_depth= 0|
drop procedure if exists bar| 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
...@@ -1479,6 +1545,52 @@ select @x2| ...@@ -1479,6 +1545,52 @@ select @x2|
@x2 @x2
2 2
drop procedure bug2260| drop procedure bug2260|
drop procedure if exists bug2267_1|
create procedure bug2267_1()
begin
show procedure status;
end|
drop procedure if exists bug2267_2|
create procedure bug2267_2()
begin
show function status;
end|
drop procedure if exists bug2267_3|
create procedure bug2267_3()
begin
show create procedure bug2267_1;
end|
drop procedure if exists bug2267_4|
drop function if exists bug2267_4|
create procedure bug2267_4()
begin
show create function bug2267_4;
end|
create function bug2267_4() returns int return 100|
call bug2267_1()|
Db Name Type Definer Modified Created Security_type Comment
test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_2()|
Db Name Type Definer Modified Created Security_type Comment
test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
call bug2267_3()|
Procedure sql_mode Create Procedure
bug2267_1 CREATE PROCEDURE `bug2267_1`()
begin
show procedure status;
end
call bug2267_4()|
Function sql_mode Create Function
bug2267_4 CREATE FUNCTION `bug2267_4`() RETURNS int(11)
return 100
drop procedure bug2267_1|
drop procedure bug2267_2|
drop procedure bug2267_3|
drop procedure bug2267_4|
drop function bug2267_4|
drop procedure if exists bug2227| drop procedure if exists bug2227|
create procedure bug2227(x int) create procedure bug2227(x int)
begin begin
...@@ -1490,6 +1602,18 @@ call bug2227(9)| ...@@ -1490,6 +1602,18 @@ 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 bug2227| drop procedure bug2227|
drop procedure if exists bug2614|
create procedure bug2614()
begin
drop table if exists t3;
create table t3 (id int default '0' not null);
insert into t3 select 12;
insert into t3 select * from t3;
end|
call bug2614()|
call bug2614()|
drop table t3|
drop procedure bug2614|
drop function if exists bug2674| drop function if exists bug2674|
create function bug2674() returns int create function bug2674() returns int
return @@sort_buffer_size| return @@sort_buffer_size|
......
...@@ -1211,15 +1211,13 @@ begin ...@@ -1211,15 +1211,13 @@ begin
end if; end if;
end| end|
select f5(1)| select f5(1)|
# This should generate an error about insuficient number of tables locked # Since currently recursive functions are disallowed ER_SP_NO_RECURSION
# Now this crash server # error will be returned, once we will allow them error about
--disable_parsing # until bug#11394 fix # insufficient number of locked tables will be returned instead.
--error 1100 --error ER_SP_NO_RECURSION
select f5(2)| select f5(2)|
# But now it simply miserably fails because we are trying to use the same --error ER_SP_NO_RECURSION
# lex on the next iteration :/ It should generate some error too...
select f5(3)| select f5(3)|
--enable_parsing
# OTOH this should work # OTOH this should work
create function f6() returns int create function f6() returns int
...@@ -1265,13 +1263,12 @@ select * from v1| ...@@ -1265,13 +1263,12 @@ select * from v1|
# views and functions ? # views and functions ?
create function f1() returns int create function f1() returns int
return (select sum(data) from t1) + (select sum(data) from v1)| return (select sum(data) from t1) + (select sum(data) from v1)|
# This queries will crash server because we can't use LEX in --error ER_SP_NO_RECURSION
# reenterable fashion yet. Patch disabling recursion will heal this.
--disable_parsing
select f1()| select f1()|
--error ER_SP_NO_RECURSION
select * from v1| select * from v1|
--error ER_SP_NO_RECURSION
select * from v2| select * from v2|
--enable_parsing
# Back to the normal cases # Back to the normal cases
drop function f1| drop function f1|
create function f1() returns int create function f1() returns int
...@@ -1289,9 +1286,7 @@ select *, f0() from v0| ...@@ -1289,9 +1286,7 @@ select *, f0() from v0|
# #
# Let us test how well prelocking works with explicit LOCK TABLES. # Let us test how well prelocking works with explicit LOCK TABLES.
# #
# Nowdays we have to lock mysql.proc to be able to read SP definitions. lock tables t1 read, t1 as t11 read|
# But Monty was going to fix this.
lock tables t1 read, t1 as t11 read, mysql.proc read|
# These should work well # These should work well
select f3()| select f3()|
select id, f3() from t1 as t11| select id, f3() from t1 as t11|
...@@ -1481,9 +1476,6 @@ show procedure status like '%p%'| ...@@ -1481,9 +1476,6 @@ show procedure status like '%p%'|
# Fibonacci, for recursion test. (Yet Another Numerical series :) # Fibonacci, for recursion test. (Yet Another Numerical series :)
# #
# This part of test is disabled until we implement support for
# recursive stored procedures.
--disable_parsing
--disable_warnings --disable_warnings
drop table if exists fib| drop table if exists fib|
--enable_warnings --enable_warnings
...@@ -1512,6 +1504,9 @@ begin ...@@ -1512,6 +1504,9 @@ begin
end if; end if;
end| end|
# Enable recursion
set @@max_sp_recursion_depth= 20|
# Minimum test: recursion of 3 levels # Minimum test: recursion of 3 levels
insert into fib values (0), (1)| insert into fib values (0), (1)|
...@@ -1531,7 +1526,7 @@ call fib(20)| ...@@ -1531,7 +1526,7 @@ call fib(20)|
select * from fib order by f asc| select * from fib order by f asc|
drop table fib| drop table fib|
drop procedure fib| drop procedure fib|
--enable_parsing set @@max_sp_recursion_depth= 0|
# #
# Comment & suid # Comment & suid
...@@ -1800,16 +1795,8 @@ select @x2| ...@@ -1800,16 +1795,8 @@ select @x2|
drop procedure bug2260| drop procedure bug2260|
# #
# BUG#2267 # BUG#2267 "Lost connect if stored procedure has SHOW FUNCTION STATUS"
# #
# NOTE: This test case will be fixed as soon as Monty
# will allow to open mysql.proc table under LOCK TABLES
# without mentioning in lock list.
#
# FIXME: Other solution would be to use preopened proc table
# instead of opening it anew.
#
--disable_parsing
--disable_warnings --disable_warnings
drop procedure if exists bug2267_1| drop procedure if exists bug2267_1|
--enable_warnings --enable_warnings
...@@ -1836,11 +1823,13 @@ end| ...@@ -1836,11 +1823,13 @@ end|
--disable_warnings --disable_warnings
drop procedure if exists bug2267_4| drop procedure if exists bug2267_4|
drop function if exists bug2267_4|
--enable_warnings --enable_warnings
create procedure bug2267_4() create procedure bug2267_4()
begin begin
show create function fac; show create function bug2267_4;
end| end|
create function bug2267_4() returns int return 100|
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00' --replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
call bug2267_1()| call bug2267_1()|
...@@ -1853,7 +1842,7 @@ drop procedure bug2267_1| ...@@ -1853,7 +1842,7 @@ 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|
--enable_parsing drop function bug2267_4|
# #
# BUG#2227 # BUG#2227
...@@ -1873,23 +1862,16 @@ call bug2227(9)| ...@@ -1873,23 +1862,16 @@ call bug2227(9)|
drop procedure bug2227| drop procedure bug2227|
# #
# BUG#2614 # BUG#2614 "Stored procedure with INSERT ... SELECT that does not
# contain any tables crashes server"
# #
# QQ The second insert doesn't work with temporary tables (it was an
# QQ ordinary table before we changed the locking scheme). It results
# QQ in an error: 1137: Can't reopen table: 't3'
# QQ which is a known limit with temporary tables.
# QQ For this reason we can't run this test any more (i.e., if we modify
# QQ it, it's no longer a test case for the bug), but we keep it here
# QQ anyway, for tracability.
--disable_parsing
--disable_warnings --disable_warnings
drop procedure if exists bug2614| drop procedure if exists bug2614|
--enable_warnings --enable_warnings
create procedure bug2614() create procedure bug2614()
begin begin
drop temporary table if exists t3; drop table if exists t3;
create temporary 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|
...@@ -1898,9 +1880,8 @@ end| ...@@ -1898,9 +1880,8 @@ end|
call bug2614()| call bug2614()|
--enable_warnings --enable_warnings
call bug2614()| call bug2614()|
drop temporary table t3| drop table t3|
drop procedure bug2614| drop procedure bug2614|
--enable_parsing
# #
# BUG#2674 # BUG#2674
......
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