mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
New test cases for BUG#1653 (recalling a procedure after replacing a faulty
table definition crashed), and recursive calls. mysql-test/r/sp.result: New test cases for BUG#1653 and recursive calls. mysql-test/t/sp.test: New test cases for BUG#1653 and recursive calls.
This commit is contained in:
@@ -801,6 +801,17 @@ avg 0 4.4
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
drop procedure bug1874;
|
||||
drop table if exists table_1;
|
||||
create table t3 (column_1_0 int);
|
||||
create procedure bug1653()
|
||||
update t3 set column_1 = 0;
|
||||
call bug1653();
|
||||
ERROR 42S22: Unknown column 'column_1' in 'field list'
|
||||
drop table t3;
|
||||
create table t3 (column_1 int);
|
||||
call bug1653();
|
||||
drop procedure bug1653;
|
||||
drop table t3;
|
||||
drop table if exists fac;
|
||||
create table fac (n int unsigned not null primary key, f bigint unsigned);
|
||||
create procedure ifac(n int unsigned)
|
||||
@@ -948,6 +959,51 @@ drop procedure opp;
|
||||
drop procedure ip;
|
||||
show procedure status like '%p%';
|
||||
Name Type Creator Modified Created Suid Comment
|
||||
drop table if exists fib;
|
||||
create table fib ( f bigint unsigned not null );
|
||||
insert into fib values (1), (1);
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 0 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;
|
||||
call fib(20);
|
||||
select * from fib order by f asc;
|
||||
f
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
8
|
||||
13
|
||||
21
|
||||
34
|
||||
55
|
||||
89
|
||||
144
|
||||
233
|
||||
377
|
||||
610
|
||||
987
|
||||
1597
|
||||
2584
|
||||
4181
|
||||
6765
|
||||
10946
|
||||
17711
|
||||
drop table fib;
|
||||
drop procedure fib;
|
||||
create procedure bar(x char(16), y int)
|
||||
comment "111111111111" sql security invoker
|
||||
insert into test.t1 values (x, y);
|
||||
|
@@ -815,6 +815,11 @@ delete from t2|
|
||||
drop table t3|
|
||||
drop procedure cur2|
|
||||
|
||||
|
||||
#
|
||||
# Test cases for old bugs
|
||||
#
|
||||
|
||||
#
|
||||
# BUG#822
|
||||
#
|
||||
@@ -898,7 +903,6 @@ select @1, @2|
|
||||
drop table t70|
|
||||
drop procedure bug1656|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1862
|
||||
#
|
||||
@@ -920,7 +924,6 @@ select * from t3|
|
||||
drop table t3|
|
||||
drop procedure bug1862|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1874
|
||||
#
|
||||
@@ -945,6 +948,26 @@ delete from t1|
|
||||
delete from t2|
|
||||
drop procedure bug1874|
|
||||
|
||||
#
|
||||
# BUG#1653
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists table_1|
|
||||
--enable_warnings
|
||||
create table t3 (column_1_0 int)|
|
||||
|
||||
create procedure bug1653()
|
||||
update t3 set column_1 = 0|
|
||||
|
||||
--error 1054
|
||||
call bug1653()|
|
||||
drop table t3|
|
||||
create table t3 (column_1 int)|
|
||||
call bug1653()|
|
||||
|
||||
drop procedure bug1653|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# Some "real" examples
|
||||
@@ -1071,7 +1094,47 @@ drop procedure ip|
|
||||
--replace_column 4 '0000-00-00 00:00:00' 5 '0000-00-00 00:00:00'
|
||||
show procedure status like '%p%'|
|
||||
|
||||
|
||||
# Fibonacci, for recursion test. (Yet Another Numerical series :)
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists fib|
|
||||
--enable_warnings
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
|
||||
insert into fib values (1), (1)|
|
||||
|
||||
# We deliberately do it the awkward way, fetching the last two
|
||||
# values from the table, in order to exercise various statements
|
||||
# and table accesses at each turn.
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 0 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|
|
||||
|
||||
call fib(20)|
|
||||
|
||||
select * from fib order by f asc|
|
||||
drop table fib|
|
||||
drop procedure fib|
|
||||
|
||||
|
||||
#
|
||||
# Comment & suid
|
||||
#
|
||||
|
||||
create procedure bar(x char(16), y int)
|
||||
comment "111111111111" sql security invoker
|
||||
insert into test.t1 values (x, y)|
|
||||
|
Reference in New Issue
Block a user