diff options
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/mysql-test-run.sh | 12 | ||||
-rw-r--r-- | mysql-test/r/endspace.result | 2 | ||||
-rw-r--r-- | mysql-test/r/func_group.result | 59 | ||||
-rw-r--r-- | mysql-test/r/grant2.result | 28 | ||||
-rw-r--r-- | mysql-test/r/olap.result | 13 | ||||
-rw-r--r-- | mysql-test/r/sp.result | 19 | ||||
-rw-r--r-- | mysql-test/r/sp_trans.result | 24 | ||||
-rw-r--r-- | mysql-test/t/func_group.test | 23 | ||||
-rw-r--r-- | mysql-test/t/grant2.test | 39 | ||||
-rw-r--r-- | mysql-test/t/olap.test | 16 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 9 | ||||
-rw-r--r-- | mysql-test/t/sp-threads.test | 12 | ||||
-rw-r--r-- | mysql-test/t/sp.test | 46 | ||||
-rw-r--r-- | mysql-test/t/sp_trans.test | 41 |
14 files changed, 298 insertions, 45 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh index 92561496544..e4343807124 100644 --- a/mysql-test/mysql-test-run.sh +++ b/mysql-test/mysql-test-run.sh @@ -1535,12 +1535,12 @@ run_testcase () return fi - if [ -f "$TESTDIR/$tname.disabled" ] - then - comment=`$CAT $TESTDIR/$tname.disabled`; - disable_test $tname "$comment" - return - fi +# if [ -f "$TESTDIR/$tname.disabled" ] +# then +# comment=`$CAT $TESTDIR/$tname.disabled`; +# disable_test $tname "$comment" +# return +# fi if [ -f "$TESTDIR/disabled.def" ] ; then comment=`$GREP "^$tname *: *" $TESTDIR/disabled.def`; if [ -n "$comment" ] diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result index e9396c9a6ed..0e68418a80f 100644 --- a/mysql-test/r/endspace.result +++ b/mysql-test/r/endspace.result @@ -201,10 +201,12 @@ teststring select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%'; text1 length(text1) teststring 11 +teststring 10 teststring 11 select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t'; text1 length(text1) teststring 11 +teststring 10 teststring 11 select concat('|', text1, '|') from t1 order by text1; concat('|', text1, '|') diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 81663cd9d66..3e06018226d 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -888,3 +888,62 @@ SELECT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 2 DROP TABLE t1; +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 (a, b, c) VALUES +(1,1,1), (1,1,2), (1,1,3), +(1,2,1), (1,2,2), (1,2,3), +(1,3,1), (1,3,2), (1,3,3), +(2,1,1), (2,1,2), (2,1,3), +(2,2,1), (2,2,2), (2,2,3), +(2,3,1), (2,3,2), (2,3,3), +(3,1,1), (3,1,2), (3,1,3), +(3,2,1), (3,2,2), (3,2,3), +(3,3,1), (3,3,2), (3,3,3); +SELECT b/c as v, a FROM t1 ORDER BY v; +v a +0.33333 3 +0.33333 1 +0.33333 2 +0.50000 1 +0.50000 2 +0.50000 3 +0.66667 2 +0.66667 1 +0.66667 3 +1.00000 3 +1.00000 2 +1.00000 3 +1.00000 1 +1.00000 2 +1.00000 3 +1.00000 2 +1.00000 1 +1.00000 1 +1.50000 3 +1.50000 2 +1.50000 1 +2.00000 1 +2.00000 3 +2.00000 2 +3.00000 3 +3.00000 2 +3.00000 1 +SELECT b/c as v, SUM(a) FROM t1 GROUP BY v; +v SUM(a) +0.33333 6 +0.50000 6 +0.66667 6 +1.00000 18 +1.50000 6 +2.00000 6 +3.00000 6 +SELECT SUM(a) FROM t1 GROUP BY b/c; +SUM(a) +6 +6 +6 +18 +6 +6 +6 +DROP TABLE t1; diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index e6c78fdfdd4..e6db7bd682f 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -5,6 +5,23 @@ delete from mysql.db where user like 'mysqltest\_%'; delete from mysql.tables_priv where user like 'mysqltest\_%'; delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; +grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option; +create user mysqltest_2@localhost; +grant select on `my\_1`.* to mysqltest_2@localhost; +grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; +ERROR 42000: You must have privileges to update tables in the mysql database to be able to change passwords for others +grant update on mysql.* to mysqltest_1@localhost; +grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; +grant select on `my\_1`.* to mysqltest_3@localhost; +ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users +grant insert on mysql.* to mysqltest_1@localhost; +grant select on `my\_1`.* to mysqltest_3@localhost; +grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass'; +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +delete from mysql.tables_priv where user like 'mysqltest\_%'; +delete from mysql.columns_priv where user like 'mysqltest\_%'; +flush privileges; grant all privileges on `my\_%`.* to mysqltest_1@localhost with grant option; select current_user(); current_user() @@ -13,6 +30,7 @@ select current_user; current_user mysqltest_1@localhost grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; +ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'my_%' set @@sql_mode='NO_AUTO_CREATE_USER'; @@ -23,15 +41,13 @@ grant select on `my\_1`.* to mysqltest_4@localhost with grant option; ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass' with grant option; -ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysql' +ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users show grants for mysqltest_1@localhost; Grants for mysqltest_1@localhost GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' GRANT ALL PRIVILEGES ON `my\_%`.* TO 'mysqltest_1'@'localhost' WITH GRANT OPTION show grants for mysqltest_2@localhost; -Grants for mysqltest_2@localhost -GRANT USAGE ON *.* TO 'mysqltest_2'@'localhost' -GRANT ALL PRIVILEGES ON `my\_1`.* TO 'mysqltest_2'@'localhost' WITH GRANT OPTION +ERROR 42000: There is no such grant defined for user 'mysqltest_2' on host 'localhost' show grants for mysqltest_3@localhost; ERROR 42000: There is no such grant defined for user 'mysqltest_3' on host 'localhost' delete from mysql.user where user like 'mysqltest\_%'; @@ -61,9 +77,9 @@ flush privileges; create table t1 (a int, b int); grant select (a) on t1 to mysqltest_1@localhost with grant option; grant select (a,b) on t1 to mysqltest_2@localhost; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for column 'b' in table 't1' +ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users grant select on t1 to mysqltest_3@localhost; -ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1' +ERROR 42000: 'mysqltest_1'@'localhost' is not allowed to create new users drop table t1; delete from mysql.user where user like 'mysqltest\_%'; delete from mysql.db where user like 'mysqltest\_%'; diff --git a/mysql-test/r/olap.result b/mysql-test/r/olap.result index b04cd6fd068..4863cb5b75e 100644 --- a/mysql-test/r/olap.result +++ b/mysql-test/r/olap.result @@ -379,3 +379,16 @@ a sum(b) 4 4 NULL 14 DROP TABLE t1; +CREATE TABLE t1 (a int, b int); +INSERT INTO t1 VALUES +(1,4), +(2,2), (2,2), +(4,1), (4,1), (4,1), (4,1), +(2,1), (2,1); +SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +a SUM(b) +1 4 +SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +a SUM(b) +1 4 +DROP TABLE t1; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index 5366ecb2be3..b2a1af03c9f 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -2777,4 +2777,23 @@ a 3.2000 drop procedure bug8937| delete from t1| +drop procedure if exists bug6600| +drop table if exists t3| +drop view if exists v1| +create table t3 (s1 decimal(31,30))| +create view v1 as select * from t3| +create procedure bug6600() +check table v1| +call bug6600()| +Table Op Msg_type Msg_text +test.v1 check status OK +call bug6600()| +Table Op Msg_type Msg_text +test.v1 check status OK +call bug6600()| +Table Op Msg_type Msg_text +test.v1 check status OK +drop procedure bug6600| +drop view v1| +drop table t3| drop table t1,t2; diff --git a/mysql-test/r/sp_trans.result b/mysql-test/r/sp_trans.result index 0a28fae3c0d..dee87979ff4 100644 --- a/mysql-test/r/sp_trans.result +++ b/mysql-test/r/sp_trans.result @@ -1,22 +1,22 @@ -drop procedure if exists sp1; +drop procedure if exists bug8850| create table t1 (a int) engine=innodb| -create procedure sp1 () +create procedure bug8850() begin truncate table t1; insert t1 values (1); rollback; end| -set autocommit=0; -insert t1 values (2); -call sp1(); +set autocommit=0| +insert t1 values (2)| +call bug8850()| ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction -commit; -select * from t1; +commit| +select * from t1| a 2 -call sp1(); +call bug8850()| ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction -set autocommit=1; -select * from t1; +set autocommit=1| +select * from t1| a 2 -drop table t1; -drop procedure sp1; +drop table t1| +drop procedure bug8850| diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 0f03eae7e12..9b6f91067d4 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -601,3 +601,26 @@ INSERT INTO t1 (a) VALUES ("A"), ("a"), ("a "), ("a "), ("B"), ("b"), ("b "), ("b "); SELECT COUNT(DISTINCT a) FROM t1; DROP TABLE t1; + +# +# Test for buf #9210: GROUP BY with expression if a decimal type +# + +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 (a, b, c) VALUES + (1,1,1), (1,1,2), (1,1,3), + (1,2,1), (1,2,2), (1,2,3), + (1,3,1), (1,3,2), (1,3,3), + (2,1,1), (2,1,2), (2,1,3), + (2,2,1), (2,2,2), (2,2,3), + (2,3,1), (2,3,2), (2,3,3), + (3,1,1), (3,1,2), (3,1,3), + (3,2,1), (3,2,2), (3,2,3), + (3,3,1), (3,3,2), (3,3,3); + +SELECT b/c as v, a FROM t1 ORDER BY v; +SELECT b/c as v, SUM(a) FROM t1 GROUP BY v; +SELECT SUM(a) FROM t1 GROUP BY b/c; + +DROP TABLE t1; + diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 58f91fddcc2..f86cf2a1db7 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -17,6 +17,36 @@ delete from mysql.columns_priv where user like 'mysqltest\_%'; flush privileges; +grant all privileges on `my\_1`.* to mysqltest_1@localhost with grant option; +create user mysqltest_2@localhost; +connect (user_a,localhost,mysqltest_1,,); +connection user_a; +grant select on `my\_1`.* to mysqltest_2@localhost; +--error 1132 +grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; +disconnect user_a; +connection default; +grant update on mysql.* to mysqltest_1@localhost; +connect (user_b,localhost,mysqltest_1,,); +connection user_b; +grant select on `my\_1`.* to mysqltest_2@localhost identified by 'pass'; +--error 1211 +grant select on `my\_1`.* to mysqltest_3@localhost; +disconnect user_b; +connection default; +grant insert on mysql.* to mysqltest_1@localhost; +connect (user_c,localhost,mysqltest_1,,); +connection user_c; +grant select on `my\_1`.* to mysqltest_3@localhost; +grant select on `my\_1`.* to mysqltest_4@localhost identified by 'pass'; +disconnect user_c; +connection default; +delete from mysql.user where user like 'mysqltest\_%'; +delete from mysql.db where user like 'mysqltest\_%'; +delete from mysql.tables_priv where user like 'mysqltest\_%'; +delete from mysql.columns_priv where user like 'mysqltest\_%'; +flush privileges; + # # wild_compare fun # @@ -26,9 +56,11 @@ connect (user1,localhost,mysqltest_1,,); connection user1; select current_user(); select current_user; +--error 1211 grant all privileges on `my\_1`.* to mysqltest_2@localhost with grant option; --error 1044 grant all privileges on `my_%`.* to mysqltest_3@localhost with grant option; + # # NO_AUTO_CREATE_USER mode # @@ -36,12 +68,13 @@ set @@sql_mode='NO_AUTO_CREATE_USER'; select @@sql_mode; --error 1211 grant select on `my\_1`.* to mysqltest_4@localhost with grant option; ---error 1044 +--error 1211 grant select on `my\_1`.* to mysqltest_4@localhost identified by 'mypass' with grant option; disconnect user1; connection default; show grants for mysqltest_1@localhost; +--error 1141 show grants for mysqltest_2@localhost; --error 1141 show grants for mysqltest_3@localhost; @@ -83,9 +116,9 @@ create table t1 (a int, b int); grant select (a) on t1 to mysqltest_1@localhost with grant option; connect (mrugly, localhost, mysqltest_1,,mysqltest); connection mrugly; ---error 1143 +--error 1211 grant select (a,b) on t1 to mysqltest_2@localhost; ---error 1142 +--error 1211 grant select on t1 to mysqltest_3@localhost; disconnect mrugly; diff --git a/mysql-test/t/olap.test b/mysql-test/t/olap.test index 6778af3d533..3aac0f45ead 100644 --- a/mysql-test/t/olap.test +++ b/mysql-test/t/olap.test @@ -155,3 +155,19 @@ SELECT DISTINCT a, sum(b) FROM t1 GROUP BY a,b WITH ROLLUP; DROP TABLE t1; +# +# Tests for bugs #8617: SQL_CACL_FOUND_ROWS with rollup and limit +# + +CREATE TABLE t1 (a int, b int); + +INSERT INTO t1 VALUES + (1,4), + (2,2), (2,2), + (4,1), (4,1), (4,1), (4,1), + (2,1), (2,1); + +SELECT a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; +SELECT SQL_CALC_FOUND_ROWS a, SUM(b) FROM t1 GROUP BY a WITH ROLLUP LIMIT 1; + +DROP TABLE t1; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 0f775958d7a..53783e7c9bf 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -680,6 +680,15 @@ begin end| +# +# BUG#NNNN: New bug synopsis +# +#--disable_warnings +#drop procedure if exists bugNNNN| +#--enable_warnings +#create procedure bugNNNN... + + drop table t1| delimiter ;| diff --git a/mysql-test/t/sp-threads.test b/mysql-test/t/sp-threads.test index 27888158f03..0ced60a610f 100644 --- a/mysql-test/t/sp-threads.test +++ b/mysql-test/t/sp-threads.test @@ -1,5 +1,6 @@ # -# Testing stored procedures with multiple connections +# Testing stored procedures with multiple connections, +# except security/privilege tests, they go to sp-security.test # connect (con1root,localhost,root,,); @@ -52,3 +53,12 @@ connection con1root; drop table t1; drop procedure bug4934; + +# +# BUG#NNNN: New bug synopsis +# +#--disable_warnings +#drop procedure if exists bugNNNN; +#--enable_warnings +#create procedure bugNNNN... + diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index fe00038a595..5c2e02045c5 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -4,11 +4,22 @@ # Please keep this file free of --error cases and other # things that will not run in a single debugged mysqld # process (e.g. master-slave things). - --- source include/have_innodb.inc +# +# Test cases for bugs are added at the end. See template there. +# +# Tests that require --error go into sp-error.test +# Tests that require inndb go into sp_trans.test +# Tests that check privilege and security issues go to sp-security.test. +# Tests that require multiple connections, except security/privilege tests, +# go to sp-thread. use test; +# Test tables +# +# t1 and t2 are reused throughout the file, and dropped at the end. +# t3 and up are created and dropped when needed. +# --disable_warnings drop table if exists t1; --enable_warnings @@ -3387,6 +3398,37 @@ drop procedure bug8937| delete from t1| +# +# BUG#6600: Stored procedure crash after repeated calls with check table +# +--disable_warnings +drop procedure if exists bug6600| +drop table if exists t3| +drop view if exists v1| +--enable_warnings +create table t3 (s1 decimal(31,30))| +create view v1 as select * from t3| + +create procedure bug6600() + check table v1| + +call bug6600()| +call bug6600()| +call bug6600()| +drop procedure bug6600| +drop view v1| +drop table t3| + + +# +# BUG#NNNN: New bug synopsis +# +#--disable_warnings +#drop procedure if exists bugNNNN| +#--enable_warnings +#create procedure bugNNNN... + + # Add bugs above this line. Use existing tables t1 and t2 when # practical, or create table t3, t3 etc temporarily (and drop them). delimiter ;| diff --git a/mysql-test/t/sp_trans.test b/mysql-test/t/sp_trans.test index 30622027a94..f5b38ada674 100644 --- a/mysql-test/t/sp_trans.test +++ b/mysql-test/t/sp_trans.test @@ -4,32 +4,43 @@ -- source include/have_innodb.inc +delimiter |; + # -# BUG#8850 +# BUG#8850: Truncate table in a stored procedure locks the tables # --disable_warnings -drop procedure if exists sp1; +drop procedure if exists bug8850| --enable_warnings -delimiter |; create table t1 (a int) engine=innodb| -create procedure sp1 () +create procedure bug8850() begin truncate table t1; insert t1 values (1); rollback; end| -delimiter ;| -set autocommit=0; -insert t1 values (2); + +set autocommit=0| +insert t1 values (2)| --error 1192 -call sp1(); -commit; -select * from t1; +call bug8850()| +commit| +select * from t1| # # when CALL will be fixed to not start a transaction, the error should # go away --error 1192 -call sp1(); -set autocommit=1; -select * from t1; -drop table t1; -drop procedure sp1; +call bug8850()| +set autocommit=1| +select * from t1| +drop table t1| +drop procedure bug8850| + +# +# BUG#NNNN: New bug synopsis +# +#--disable_warnings +#drop procedure if exists bugNNNN| +#--enable_warnings +#create procedure bugNNNN... + +delimiter ;| |