From 2acff5c36d99b9726b152bcf8b5286fb46849d88 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Mar 2006 12:08:23 +0100 Subject: [PATCH] Bug#10656 Stored Procedure - Create index and Truncate table command error -Add test case Move testcase that needs innodb from sp.test => sp_trans.test mysql-test/r/sp.result: Move test cases tyhat requires innodb to sp_trans.test mysql-test/r/sp_trans.result: Move test cases tyhat requires innodb to sp_trans.test Add test case for bug#10656 mysql-test/t/sp.test: Move test cases tyhat requires innodb to sp_trans.test mysql-test/t/sp_trans.test: Add test case for bug#10656 Move test cases that require innodb to sp_trans.test --- mysql-test/r/sp.result | 71 ------------------- mysql-test/r/sp_trans.result | 105 +++++++++++++++++++++++++++ mysql-test/t/sp.test | 86 ---------------------- mysql-test/t/sp_trans.test | 134 +++++++++++++++++++++++++++++++++++ 4 files changed, 239 insertions(+), 157 deletions(-) diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index a4c920f8e15..911048d1b2d 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2197,35 +2197,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time| 2 01-01-1970 03:16:40 drop procedure bug3426| create table t3 ( -a int primary key, -ach char(1) -) engine = innodb| -create table t4 ( -b int primary key , -bch char(1) -) engine = innodb| -insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')| -Warnings: -Warning 1265 Data truncated for column 'ach' at row 1 -Warning 1265 Data truncated for column 'ach' at row 2 -insert into t4 values (1 , 'bCh1' )| -Warnings: -Warning 1265 Data truncated for column 'bch' at row 1 -drop procedure if exists bug3448| -create procedure bug3448() -select * from t3 inner join t4 on t3.a = t4.b| -select * from t3 inner join t4 on t3.a = t4.b| -a ach b bch -1 a 1 b -call bug3448()| -a ach b bch -1 a 1 b -call bug3448()| -a ach b bch -1 a 1 b -drop procedure bug3448| -drop table t3, t4| -create table t3 ( id int unsigned auto_increment not null primary key, title VARCHAR(200), body text, @@ -4005,48 +3976,6 @@ DROP VIEW bug13095_v1 DROP PROCEDURE IF EXISTS bug13095; DROP VIEW IF EXISTS bug13095_v1; DROP TABLE IF EXISTS bug13095_t1; -drop procedure if exists bug14210| -set @@session.max_heap_table_size=16384| -select @@session.max_heap_table_size| -@@session.max_heap_table_size -16384 -create table t3 (a char(255)) engine=InnoDB| -create procedure bug14210_fill_table() -begin -declare table_size, max_table_size int default 0; -select @@session.max_heap_table_size into max_table_size; -delete from t3; -insert into t3 (a) values (repeat('a', 255)); -repeat -insert into t3 select a from t3; -select count(*)*255 from t3 into table_size; -until table_size > max_table_size*2 end repeat; -end| -call bug14210_fill_table()| -drop procedure bug14210_fill_table| -create table t4 like t3| -create procedure bug14210() -begin -declare a char(255); -declare done int default 0; -declare c cursor for select * from t3; -declare continue handler for sqlstate '02000' set done = 1; -open c; -repeat -fetch c into a; -if not done then -insert into t4 values (upper(a)); -end if; -until done end repeat; -close c; -end| -call bug14210()| -select count(*) from t4| -count(*) -256 -drop table t3, t4| -drop procedure bug14210| -set @@session.max_heap_table_size=default| drop function if exists bug14723| drop procedure if exists bug14723| /*!50003 create function bug14723() diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index e9289cf01c7..564e31c9e32 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -425,3 +425,108 @@ x y drop procedure bug14840_1| drop procedure bug14840_2| drop table t3| +drop procedure if exists bug10656_create_index| +drop procedure if exists bug10656_myjoin| +drop procedure if exists bug10656_truncate_table| +CREATE TABLE t3 ( +`ID` int(11) default NULL, +`txt` char(5) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1| +INSERT INTO t3 (`ID`,`txt`) VALUES +(1,'a'), (2,'b'), (3,'c'), (4,'d')| +CREATE TABLE t4 ( +`ID` int(11) default NULL, +`txt` char(5) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1| +INSERT INTO t4 (`ID`,`txt`) VALUES +(1,'a'), (2,'b'), (3,'c'), (4,'d')| +create procedure bug10656_create_index() +begin +create index bug10656_my_index on t3 (ID); +end| +call bug10656_create_index()| +create procedure bug10656_myjoin() +begin +update t3, t4 set t3.txt = t4.txt where t3.id = t4.id; +end| +call bug10656_myjoin()| +create procedure bug10656_truncate_table() +begin +truncate table t3; +end| +call bug10656_truncate_table()| +drop procedure bug10656_create_index| +drop procedure bug10656_myjoin| +drop procedure bug10656_truncate_table| +drop table t3, t4| +create table t3 ( +a int primary key, +ach char(1) +) engine = innodb| +create table t4 ( +b int primary key, +bch char(1) +) engine = innodb| +insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')| +Warnings: +Warning 1265 Data truncated for column 'ach' at row 1 +Warning 1265 Data truncated for column 'ach' at row 2 +insert into t4 values (1 , 'bCh1' )| +Warnings: +Warning 1265 Data truncated for column 'bch' at row 1 +drop procedure if exists bug3448| +create procedure bug3448() +select * from t3 inner join t4 on t3.a = t4.b| +select * from t3 inner join t4 on t3.a = t4.b| +a ach b bch +1 a 1 b +call bug3448()| +a ach b bch +1 a 1 b +call bug3448()| +a ach b bch +1 a 1 b +drop procedure bug3448| +drop table t3, t4| +drop procedure if exists bug14210| +set @@session.max_heap_table_size=16384| +select @@session.max_heap_table_size| +@@session.max_heap_table_size +16384 +create table t3 (a char(255)) engine=InnoDB| +create procedure bug14210_fill_table() +begin +declare table_size, max_table_size int default 0; +select @@session.max_heap_table_size into max_table_size; +delete from t3; +insert into t3 (a) values (repeat('a', 255)); +repeat +insert into t3 select a from t3; +select count(*)*255 from t3 into table_size; +until table_size > max_table_size*2 end repeat; +end| +call bug14210_fill_table()| +drop procedure bug14210_fill_table| +create table t4 like t3| +create procedure bug14210() +begin +declare a char(255); +declare done int default 0; +declare c cursor for select * from t3; +declare continue handler for sqlstate '02000' set done = 1; +open c; +repeat +fetch c into a; +if not done then +insert into t4 values (upper(a)); +end if; +until done end repeat; +close c; +end| +call bug14210()| +select count(*) from t4| +count(*) +256 +drop table t3, t4| +drop procedure bug14210| +set @@session.max_heap_table_size=default| diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 243c1b413b7..e07821231e0 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -2602,38 +2602,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time| drop procedure bug3426| -# -# BUG#3448 -# ---disable_warnings -create table t3 ( - a int primary key, - ach char(1) -) engine = innodb| - -create table t4 ( - b int primary key , - bch char(1) -) engine = innodb| ---enable_warnings - -insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')| -insert into t4 values (1 , 'bCh1' )| - ---disable_warnings -drop procedure if exists bug3448| ---enable_warnings -create procedure bug3448() - select * from t3 inner join t4 on t3.a = t4.b| - -select * from t3 inner join t4 on t3.a = t4.b| -call bug3448()| -call bug3448()| - -drop procedure bug3448| -drop table t3, t4| - - # # BUG#3734 # @@ -4853,60 +4821,6 @@ DROP TABLE IF EXISTS bug13095_t1; delimiter |; -# -# BUG#14210: "Simple query with > operator on large table gives server -# crash" -# Check that cursors work in case when HEAP tables are converted to -# MyISAM -# ---disable_warnings -drop procedure if exists bug14210| ---enable_warnings -set @@session.max_heap_table_size=16384| -select @@session.max_heap_table_size| -# To trigger the memory corruption the original table must be InnoDB. -# No harm if it's not, so don't warn if the suite is run with --skip-innodb ---disable_warnings -create table t3 (a char(255)) engine=InnoDB| ---enable_warnings -create procedure bug14210_fill_table() -begin - declare table_size, max_table_size int default 0; - select @@session.max_heap_table_size into max_table_size; - delete from t3; - insert into t3 (a) values (repeat('a', 255)); - repeat - insert into t3 select a from t3; - select count(*)*255 from t3 into table_size; - until table_size > max_table_size*2 end repeat; -end| -call bug14210_fill_table()| -drop procedure bug14210_fill_table| -create table t4 like t3| - -create procedure bug14210() -begin - declare a char(255); - declare done int default 0; - declare c cursor for select * from t3; - declare continue handler for sqlstate '02000' set done = 1; - open c; - repeat - fetch c into a; - if not done then - insert into t4 values (upper(a)); - end if; - until done end repeat; - close c; -end| -call bug14210()| -select count(*) from t4| - -drop table t3, t4| -drop procedure bug14210| -set @@session.max_heap_table_size=default| - - # # BUG#1473: Dumping of stored functions seems to cause corruption in # the function body diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index b9bd4c938b3..1ea32316f1e 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -419,6 +419,140 @@ drop procedure bug14840_2| drop table t3| +# +# BUG#10656: Stored Procedure - Create index and Truncate table command error +# +--disable_warnings +drop procedure if exists bug10656_create_index| +drop procedure if exists bug10656_myjoin| +drop procedure if exists bug10656_truncate_table| +--enable_warnings + +CREATE TABLE t3 ( + `ID` int(11) default NULL, + `txt` char(5) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1| + +INSERT INTO t3 (`ID`,`txt`) VALUES + (1,'a'), (2,'b'), (3,'c'), (4,'d')| + +CREATE TABLE t4 ( + `ID` int(11) default NULL, + `txt` char(5) default NULL +) ENGINE=InnoDB DEFAULT CHARSET=latin1| + +INSERT INTO t4 (`ID`,`txt`) VALUES + (1,'a'), (2,'b'), (3,'c'), (4,'d')| + +create procedure bug10656_create_index() +begin + create index bug10656_my_index on t3 (ID); +end| +call bug10656_create_index()| + +create procedure bug10656_myjoin() +begin + update t3, t4 set t3.txt = t4.txt where t3.id = t4.id; +end| +call bug10656_myjoin()| + +create procedure bug10656_truncate_table() +begin + truncate table t3; +end| +call bug10656_truncate_table()| + + +drop procedure bug10656_create_index| +drop procedure bug10656_myjoin| +drop procedure bug10656_truncate_table| +drop table t3, t4| + +# +# BUG#3448 +# +--disable_warnings +create table t3 ( + a int primary key, + ach char(1) +) engine = innodb| + +create table t4 ( + b int primary key, + bch char(1) +) engine = innodb| +--enable_warnings + +insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')| +insert into t4 values (1 , 'bCh1' )| + +--disable_warnings +drop procedure if exists bug3448| +--enable_warnings +create procedure bug3448() + select * from t3 inner join t4 on t3.a = t4.b| + +select * from t3 inner join t4 on t3.a = t4.b| +call bug3448()| +call bug3448()| + +drop procedure bug3448| +drop table t3, t4| + +# +# BUG#14210: "Simple query with > operator on large table gives server +# crash" +# Check that cursors work in case when HEAP tables are converted to +# MyISAM +# +--disable_warnings +drop procedure if exists bug14210| +--enable_warnings +set @@session.max_heap_table_size=16384| +select @@session.max_heap_table_size| +# To trigger the memory corruption the original table must be InnoDB. +# No harm if it's not, so don't warn if the suite is run with --skip-innodb +--disable_warnings +create table t3 (a char(255)) engine=InnoDB| +--enable_warnings +create procedure bug14210_fill_table() +begin + declare table_size, max_table_size int default 0; + select @@session.max_heap_table_size into max_table_size; + delete from t3; + insert into t3 (a) values (repeat('a', 255)); + repeat + insert into t3 select a from t3; + select count(*)*255 from t3 into table_size; + until table_size > max_table_size*2 end repeat; +end| +call bug14210_fill_table()| +drop procedure bug14210_fill_table| +create table t4 like t3| + +create procedure bug14210() +begin + declare a char(255); + declare done int default 0; + declare c cursor for select * from t3; + declare continue handler for sqlstate '02000' set done = 1; + open c; + repeat + fetch c into a; + if not done then + insert into t4 values (upper(a)); + end if; + until done end repeat; + close c; +end| +call bug14210()| +select count(*) from t4| + +drop table t3, t4| +drop procedure bug14210| +set @@session.max_heap_table_size=default| + + # # BUG#NNNN: New bug synopsis #