diff options
Diffstat (limited to 'mysql-test/t')
44 files changed, 1619 insertions, 380 deletions
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test index c966b51d861..5b819620e29 100644 --- a/mysql-test/t/archive.test +++ b/mysql-test/t/archive.test @@ -5,6 +5,8 @@ -- source include/have_archive.inc -- source include/have_binlog_format_mixed_or_statement.inc +call mtr.add_suppression("Table 't1' is marked as crashed and should be repaired"); + --disable_warnings DROP TABLE if exists t1,t2,t3,t4,t5,t6; --enable_warnings diff --git a/mysql-test/t/auto_increment.test b/mysql-test/t/auto_increment.test index 076e32eb22c..2a621250480 100644 --- a/mysql-test/t/auto_increment.test +++ b/mysql-test/t/auto_increment.test @@ -342,3 +342,41 @@ SELECT a FROM t2; DROP TABLE t1, t2; +--echo # +--echo # Bug#39828 autoinc wraps around when offset and increment > 1 +--echo # + +CREATE TABLE t1 (c1 BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY(c1)) engine=MyISAM; +INSERT INTO t1 VALUES(1); +INSERT INTO t1 VALUES (18446744073709551601); + +SET @@SESSION.AUTO_INCREMENT_INCREMENT=10; + +SELECT @@SESSION.AUTO_INCREMENT_OFFSET; +--error ER_WARN_DATA_OUT_OF_RANGE +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SELECT * FROM t1; + +SET @@SESSION.AUTO_INCREMENT_INCREMENT=default; +SET @@SESSION.AUTO_INCREMENT_OFFSET=default; + +DROP TABLE t1; + +--echo End of 5.1 tests + +--echo # +--echo # Bug#50619 assert in handler::update_auto_increment +--echo # + +CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk)); +# This triggered the assert +INSERT INTO t1 VALUES (NULL), (-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; + +# Check that that true overflow still gives error +CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk)); +--error ER_AUTOINC_READ_FAILED +INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL); +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/t/change_user.test b/mysql-test/t/change_user.test index 5639e013de8..b4ac526a80e 100644 --- a/mysql-test/t/change_user.test +++ b/mysql-test/t/change_user.test @@ -78,7 +78,7 @@ SET @@session.max_join_size = default; SELECT @@session.sql_big_selects; # On some machines the following will result into a warning --disable_warnings -SET @@global.max_join_size = -1; +SET @@global.max_join_size = 18446744073709551615; --enable_warnings SET @@session.max_join_size = default; --echo change_user diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test index 8fbdd709364..e5c6e8371bf 100644 --- a/mysql-test/t/connect.test +++ b/mysql-test/t/connect.test @@ -320,6 +320,31 @@ if ($error) --echo # -- Success: more than --extra-max-connections + 1 normal connections not possible } +########################################################################### + +--echo # +--echo # -- Bug#49752: 2469.126.2 unintentionally breaks authentication +--echo # against MySQL 5.1 server +--echo # + +GRANT ALL ON test.* TO 'Azundris12345678'@'localhost' IDENTIFIED BY 'test123'; + +FLUSH PRIVILEGES; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +connect (con1,localhost,Azundris123456789,test123,test); +disconnect con1; + +connection default; + +DROP USER 'Azundris12345678'@'localhost'; + +FLUSH PRIVILEGES; + +--echo # +--echo # -- End of Bug#49752 +--echo # + --echo # ------------------------------------------------------------------ --echo # -- End of 5.1 tests --echo # ------------------------------------------------------------------ diff --git a/mysql-test/t/csv.test b/mysql-test/t/csv.test index 4e337d54660..fd08f7c5a40 100644 --- a/mysql-test/t/csv.test +++ b/mysql-test/t/csv.test @@ -4,6 +4,9 @@ --source include/have_csv.inc +call mtr.add_suppression("Table 'test_repair_table2' is marked as crashed and should be repaired"); +call mtr.add_suppression("Table 'test_repair_table4' is marked as crashed and should be repaired"); + # # Simple select test # diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test index 5e2bc5dc820..0e3edce825a 100644 --- a/mysql-test/t/ctype_cp1251.test +++ b/mysql-test/t/ctype_cp1251.test @@ -49,3 +49,13 @@ select * from t1 where a like 'we_%'; drop table t1; # End of 4.1 tests + +--echo # +--echo # Start of 5.1 tests +--echo # + +--source include/ctype_8bit.inc + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index b12436f77ba..a7e6351161b 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -127,3 +127,8 @@ DROP TABLE `abcÿdef`; select hex(cast(_ascii 0x7f as char(1) character set latin1)); --echo End of 5.0 tests + +--echo # +--echo # Bug#58022 ... like ... escape export_set ( ... ) crashes when export_set returns warnings +--echo # +SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); diff --git a/mysql-test/t/ctype_ujis.test b/mysql-test/t/ctype_ujis.test index 400f1301dd3..4c29a2e11a0 100644 --- a/mysql-test/t/ctype_ujis.test +++ b/mysql-test/t/ctype_ujis.test @@ -1209,6 +1209,13 @@ DROP PROCEDURE sp1; DROP TABLE t1; DROP TABLE t2; +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT CONVERT(REPLACE(EXPORT_SET('a','a','a','','a'),'00','') USING ujis); + + set names default; set character_set_database=default; set character_set_server=default; diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test index e5dc7ffa53e..2a5de8ca9ba 100644 --- a/mysql-test/t/date_formats.test +++ b/mysql-test/t/date_formats.test @@ -359,3 +359,19 @@ SELECT DATE_FORMAT("0000-02-28",'%W %d %M %Y') as valid_date; SELECT DATE_FORMAT("2009-01-01",'%W %d %M %Y') as valid_date; --echo "End of 5.0 tests" + + +--echo # +--echo # Start of 5.1 tests +--echo # + +--echo # +--echo # Bug#58005 utf8 + get_format causes failed assertion: !str || str != Ptr' +--echo # +SET NAMES utf8; +SELECT LEAST('%', GET_FORMAT(datetime, 'eur'), CAST(GET_FORMAT(datetime, 'eur') AS CHAR(65535))); +SET NAMES latin1; + +--echo # +--echo # End of 5.1 tests +--echo # diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test index a1456246e94..962cec95add 100644 --- a/mysql-test/t/derived.test +++ b/mysql-test/t/derived.test @@ -303,4 +303,15 @@ SELECT 0 FROM (SELECT 0) t56, (SELECT 0) t57, (SELECT 0) t58, (SELECT 0) t59, (SELECT 0) t60, (SELECT 0) t61; # 61 == MAX_TABLES +--echo # +--echo # A nested materialized derived table is used before being populated. +--echo # (addon for bug#19077) +--echo # + +CREATE TABLE t1 (i INT, j BIGINT); +INSERT INTO t1 VALUES (1, 2), (2, 2), (3, 2); +SELECT * FROM (SELECT MIN(i) FROM t1 +WHERE j = SUBSTRING('12', (SELECT * FROM (SELECT MIN(j) FROM t1) t2))) t3; +DROP TABLE t1; + --echo # End of 5.0 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index f76058abae4..2c54131e08a 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -17,3 +17,5 @@ main.mysqlhotcopy_archive: bug#54129 2010-06-04 Horst main.events_time_zone : Test is not predictable as it depends on precise timing. main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails +log_tables-big : Bug#48646 2010-11-15 mattiasj report already exists +read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index a7072362759..1475ca082a5 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -746,4 +746,15 @@ SELECT POLYGON((SELECT 1 FROM (SELECT 1 IN (GROUP_CONCAT(t1.f1)) FROM t1, t1 t G --enable_ps_protocol DROP TABLE t1; +--echo # +--echo # Bug#58396 group_concat and explain extended are still crashy +--echo # + +CREATE TABLE t1(a INT); +--error ER_UNKNOWN_ERROR +EXPLAIN EXTENDED SELECT UPDATEXML('1', a, '1') +FROM t1 ORDER BY (SELECT GROUP_CONCAT(1) FROM t1); +SHOW WARNINGS; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index c33dad6c622..6e0a3fe2589 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1097,6 +1097,27 @@ SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1 DROP TABLE t1; --echo # +--echo # Bug#58030 crash in Item_func_geometry_from_text::val_str +--echo # + +--disable_result_log + +SELECT MAX(TIMESTAMP(RAND(0))); +SELECT MIN(TIMESTAMP(RAND(0))); + +--echo # +--echo # Bug#58177 crash and valgrind warnings in decimal and protocol sending functions... +--echo # + +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT MIN(GET_LOCK('aaaaaaaaaaaaaaaaa',0) / '0b1111111111111111111111111111111111111111111111111111111111111111111111111' ^ (RAND())); +SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); + +--enable_result_log + +--echo # --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index b0c92c9d6ab..c8ea11c7490 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -315,4 +315,13 @@ SELECT -9223372036854775808 DIV -1; SELECT -9223372036854775808 MOD -1; SELECT -9223372036854775808999 MOD -1; +--echo # +--echo # Bug#57810 case/when/then : Assertion failed: length || !scale +--echo # + +SELECT CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END; +CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1)) END) AS CHAR) as C; +SHOW CREATE TABLE t1; +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test index 3392a41519b..fdcfbcf519e 100644 --- a/mysql-test/t/func_str.test +++ b/mysql-test/t/func_str.test @@ -1362,4 +1362,11 @@ SELECT 1 FROM t1, t1 t2 ORDER BY QUOTE(t1.a); DROP TABLE t1; +--echo # +--echo # Bug#57913 large negative number to string conversion functions crash +--echo # Bug#57810 case/when/then : Assertion failed: length || !scale +--echo # +SELECT '1' IN ('1', SUBSTRING(-9223372036854775809, 1)); +SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); + --echo End of 5.1 tests diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 57eee43d75e..6190c2f42fa 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -849,4 +849,14 @@ INSERT INTO t1 VALUES (0),(9.216e-096); SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a); DROP TABLE t1; +--echo # +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column +--echo # + +CREATE TABLE t1(a CHAR(10) NOT NULL); +INSERT INTO t1 VALUES (''),(''); +SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index fd0a18ab4dd..97fc6f94b6a 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -744,4 +744,14 @@ SET @a=0x00000000030000000000000000000000000000000000144000000000000014400000000 SET @a=POLYFROMWKB(@a); +# +# Bug #57321 crashes and valgrind errors from spatial types +# + +create table t1(a polygon NOT NULL)engine=myisam; +insert into t1 values (geomfromtext("point(0 1)")); +insert into t1 values (geomfromtext("point(1 0)")); +select * from (select polygon(t1.a) as p from t1 order by t1.a) d; +drop table t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 97c4aaf71b6..f021e46f4ae 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1295,6 +1295,107 @@ SELECT CURRENT_USER(); SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); +# +# Bug#57952: privilege change is not taken into account by EXECUTE. +# + +--echo +--echo # Bug#57952 +--echo + +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +DROP DATABASE IF EXISTS mysqltest2; +--enable_warnings + +CREATE DATABASE mysqltest1; +CREATE DATABASE mysqltest2; + +use mysqltest1; +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1, 1); + +CREATE TABLE t2(a INT); +INSERT INTO t2 VALUES (2); + +CREATE TABLE mysqltest2.t3(a INT); +INSERT INTO mysqltest2.t3 VALUES (4); + +CREATE USER testuser@localhost; +GRANT CREATE ROUTINE, EXECUTE ON mysqltest1.* TO testuser@localhost; +GRANT SELECT(b) ON t1 TO testuser@localhost; +GRANT SELECT ON t2 TO testuser@localhost; +GRANT SELECT ON mysqltest2.* TO testuser@localhost; + +--echo +--echo # Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +--connect (bug57952_con1,localhost,testuser,,mysqltest1) +PREPARE s1 FROM 'SELECT b FROM t1'; +PREPARE s2 FROM 'SELECT a FROM t2'; +PREPARE s3 FROM 'SHOW TABLES FROM mysqltest2'; + +CREATE PROCEDURE p1() SELECT b FROM t1; +CREATE PROCEDURE p2() SELECT a FROM t2; +CREATE PROCEDURE p3() SHOW TABLES FROM mysqltest2; + +CALL p1; +CALL p2; +CALL p3; + +--echo +--echo # Connection: default +--connection default +REVOKE SELECT ON t1 FROM testuser@localhost; +GRANT SELECT(a) ON t1 TO testuser@localhost; +REVOKE SELECT ON t2 FROM testuser@localhost; +REVOKE SELECT ON mysqltest2.* FROM testuser@localhost; + +--echo +--echo # Connection: bug57952_con1 (testuser@localhost, db: mysqltest1) +--connection bug57952_con1 +--echo # - Check column-level privileges... +--error ER_COLUMNACCESS_DENIED_ERROR +EXECUTE s1; + +--error ER_COLUMNACCESS_DENIED_ERROR +SELECT b FROM t1; + +--error ER_COLUMNACCESS_DENIED_ERROR +EXECUTE s1; + +--error ER_COLUMNACCESS_DENIED_ERROR +CALL p1; + +--echo # - Check table-level privileges... +--error ER_TABLEACCESS_DENIED_ERROR +SELECT a FROM t2; + +--error ER_TABLEACCESS_DENIED_ERROR +EXECUTE s2; + +--error ER_TABLEACCESS_DENIED_ERROR +CALL p2; + +--echo # - Check database-level privileges... +--error ER_DBACCESS_DENIED_ERROR +SHOW TABLES FROM mysqltest2; + +--error ER_DBACCESS_DENIED_ERROR +EXECUTE s3; + +--error ER_DBACCESS_DENIED_ERROR +CALL p3; + +--echo +--echo # Connection: default +--connection default +--disconnect bug57952_con1 +DROP DATABASE mysqltest1; +DROP DATABASE mysqltest2; +DROP USER testuser@localhost; +use test; +--echo + --echo End of 5.0 tests # diff --git a/mysql-test/t/init_file.test b/mysql-test/t/init_file.test index 343f320550c..573396f625d 100644 --- a/mysql-test/t/init_file.test +++ b/mysql-test/t/init_file.test @@ -33,4 +33,4 @@ drop table t1, t2; # MTR will restart server anyway, but by forcing it we avoid being warned # about the apparent side effect -call mtr.force_restart(); +--source include/force_restart.inc diff --git a/mysql-test/t/innodb-zip.test b/mysql-test/t/innodb-zip.test deleted file mode 100644 index 7514da087eb..00000000000 --- a/mysql-test/t/innodb-zip.test +++ /dev/null @@ -1,347 +0,0 @@ --- source include/have_innodb.inc - -let $per_table=`select @@innodb_file_per_table`; -let $format=`select @@innodb_file_format`; -let $innodb_file_format_check_orig=`select @@innodb_file_format_check`; -set global innodb_file_per_table=off; -set global innodb_file_format=`0`; - -create table t0(a int primary key) engine=innodb row_format=compressed; -create table t00(a int primary key) engine=innodb -key_block_size=4 row_format=compressed; -create table t1(a int primary key) engine=innodb row_format=dynamic; -create table t2(a int primary key) engine=innodb row_format=redundant; -create table t3(a int primary key) engine=innodb row_format=compact; -create table t4(a int primary key) engine=innodb key_block_size=9; -create table t5(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; - -set global innodb_file_per_table=on; -create table t6(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -set global innodb_file_format=`1`; -create table t7(a int primary key) engine=innodb -key_block_size=1 row_format=redundant; -create table t8(a int primary key) engine=innodb -key_block_size=1 row_format=fixed; -create table t9(a int primary key) engine=innodb -key_block_size=1 row_format=compact; -create table t10(a int primary key) engine=innodb -key_block_size=1 row_format=dynamic; -create table t11(a int primary key) engine=innodb -key_block_size=1 row_format=compressed; -create table t12(a int primary key) engine=innodb -key_block_size=1; -create table t13(a int primary key) engine=innodb -row_format=compressed; -create table t14(a int primary key) engine=innodb key_block_size=9; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -drop table t0,t00,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14; -alter table t1 key_block_size=0; -alter table t1 row_format=dynamic; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=compact; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -alter table t1 row_format=redundant; -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -create table t1(a int not null, b text, index(b(10))) engine=innodb -key_block_size=1; - -create table t2(b text)engine=innodb; -insert into t2 values(concat('1abcdefghijklmnopqrstuvwxyz', repeat('A',5000))); - -insert into t1 select 1, b from t2; -commit; - -connect (a,localhost,root,,); -connect (b,localhost,root,,); - -connection a; -begin; -update t1 set b=repeat('B',100); - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection a; -rollback; - -connection b; -select a,left(b,40) from t1 natural join t2; - -connection default; -disconnect a; -disconnect b; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1,t2; - -# The following should fail even in non-strict mode. -SET SESSION innodb_strict_mode = off; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=2 CHARSET=ASCII; -CREATE TABLE t1( - c TEXT NOT NULL, d TEXT NOT NULL, - PRIMARY KEY (c(767),d(767))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 CHARSET=ASCII; -drop table t1; ---error ER_TOO_BIG_ROWSIZE -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(440))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -# The maximum key size for a compressed row actually depends on the -# version of libz used, as account must be taken for the maximum -# compressed size of a key, and this differs between libz -# versions. Some libz versions allow a size of 439, some only 438. -CREATE TABLE t1(c TEXT, PRIMARY KEY (c(438))) -ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1 CHARSET=ASCII; -INSERT INTO t1 VALUES(REPEAT('A',512)),(REPEAT('B',512)); -DROP TABLE t1; - -# -# Test blob column inheritance (mantis issue#36) -# - -create table t1( c1 int not null, c2 blob, c3 blob, c4 blob, - primary key(c1, c2(22), c3(22))) - engine = innodb row_format = dynamic; -begin; -insert into t1 values(1, repeat('A', 20000), repeat('B', 20000), - repeat('C', 20000)); - -update t1 set c3 = repeat('D', 20000) where c1 = 1; -commit; - -# one blob column which is unchanged in update and part of PK -# one blob column which is changed and part of of PK -# one blob column which is not part of PK and is unchanged -select count(*) from t1 where c2 = repeat('A', 20000); -select count(*) from t1 where c3 = repeat('D', 20000); -select count(*) from t1 where c4 = repeat('C', 20000); - -update t1 set c3 = repeat('E', 20000) where c1 = 1; -drop table t1; - -# -# -# Test innodb_file_format -# -set global innodb_file_format=`0`; -select @@innodb_file_format; -set global innodb_file_format=`1`; -select @@innodb_file_format; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`2`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`-1`; -set global innodb_file_format=`Antelope`; -set global innodb_file_format=`Barracuda`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`Cheetah`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`abc`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=`1a`; --- error ER_WRONG_ARGUMENTS -set global innodb_file_format=``; - -#test strict mode. -# this does not work anymore, has been removed from mysqltest -# -- enable_errors -set global innodb_file_per_table = on; -set global innodb_file_format = `1`; - -set innodb_strict_mode = off; -create table t1 (id int primary key) engine = innodb key_block_size = 0; -drop table t1; - -#set strict_mode -set innodb_strict_mode = on; - -#Test different values of KEY_BLOCK_SIZE - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 0; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 9; -show warnings; - - -create table t3 (id int primary key) engine = innodb key_block_size = 1; -create table t4 (id int primary key) engine = innodb key_block_size = 2; -create table t5 (id int primary key) engine = innodb key_block_size = 4; -create table t6 (id int primary key) engine = innodb key_block_size = 8; -create table t7 (id int primary key) engine = innodb key_block_size = 16; - -#check various ROW_FORMAT values. -create table t8 (id int primary key) engine = innodb row_format = compressed; -create table t9 (id int primary key) engine = innodb row_format = dynamic; -create table t10(id int primary key) engine = innodb row_format = compact; -create table t11(id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t3, t4, t5, t6, t7, t8, t9, t10, t11; - -#test different values of ROW_FORMAT with KEY_BLOCK_SIZE -create table t1 (id int primary key) engine = innodb -key_block_size = 8 row_format = compressed; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 8 row_format = redundant; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb -key_block_size = 8 row_format = compact; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb -key_block_size = 8 row_format = dynamic; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb -key_block_size = 8 row_format = default; -show warnings; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t1; - -#test multiple errors ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb -key_block_size = 9 row_format = redundant; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = compact; -show warnings; - ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb -key_block_size = 9 row_format = dynamic; -show warnings; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; - -#test valid values with innodb_file_per_table unset -set global innodb_file_per_table = off; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show warnings; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -#test valid values with innodb_file_format unset -set global innodb_file_per_table = on; -set global innodb_file_format = `0`; - ---error ER_CANT_CREATE_TABLE -create table t1 (id int primary key) engine = innodb key_block_size = 1; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t2 (id int primary key) engine = innodb key_block_size = 2; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t3 (id int primary key) engine = innodb key_block_size = 4; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t4 (id int primary key) engine = innodb key_block_size = 8; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t5 (id int primary key) engine = innodb key_block_size = 16; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t6 (id int primary key) engine = innodb row_format = compressed; -show warnings; ---error ER_CANT_CREATE_TABLE -create table t7 (id int primary key) engine = innodb row_format = dynamic; -show warnings; -create table t8 (id int primary key) engine = innodb row_format = compact; -create table t9 (id int primary key) engine = innodb row_format = redundant; - -SELECT table_schema, table_name, row_format -FROM information_schema.tables WHERE engine='innodb'; -drop table t8, t9; - -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format=$format; -# -# Testing of tablespace tagging -# --- disable_info -set global innodb_file_per_table=on; -set global innodb_file_format=`Barracuda`; -set global innodb_file_format_check=`Antelope`; -create table normal_table ( - c1 int -) engine = innodb; -select @@innodb_file_format_check; -create table zip_table ( - c1 int -) engine = innodb key_block_size = 8; -select @@innodb_file_format_check; -set global innodb_file_format_check=`Antelope`; -select @@innodb_file_format_check; --- disable_result_log -show table status; --- enable_result_log -select @@innodb_file_format_check; -drop table normal_table, zip_table; --- disable_result_log - -# -# restore environment to the state it was before this test execution -# - --- disable_query_log -eval set global innodb_file_format=$format; -eval set global innodb_file_per_table=$per_table; -eval set global innodb_file_format_check=$innodb_file_format_check_orig; diff --git a/mysql-test/t/key_cache-master.opt b/mysql-test/t/key_cache-master.opt index 66e19c18a8a..6398e3e0a26 100644 --- a/mysql-test/t/key_cache-master.opt +++ b/mysql-test/t/key_cache-master.opt @@ -1 +1,2 @@ --key_buffer_size=2M --small.key_buffer_size=256K --small.key_buffer_size=128K +--force-restart diff --git a/mysql-test/t/key_cache.test b/mysql-test/t/key_cache.test index d77ce243e32..f415d670bf1 100644 --- a/mysql-test/t/key_cache.test +++ b/mysql-test/t/key_cache.test @@ -218,6 +218,7 @@ set global key_cache_block_size= @my_key_cache_block_size; # Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO # (One cannot drop the default key cache.) # +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE set @@global.key_buffer_size=0; select @@global.key_buffer_size; diff --git a/mysql-test/t/log_tables.test b/mysql-test/t/log_tables.test index 076f2e8bc3b..af6c34dec37 100644 --- a/mysql-test/t/log_tables.test +++ b/mysql-test/t/log_tables.test @@ -1027,6 +1027,25 @@ DROP TABLE t1; TRUNCATE TABLE mysql.slow_log; +# +# Bug #47924 main.log_tables times out sporadically +# + +use mysql; +# Should result in error +--disable_warnings +drop table if exists renamed_general_log; +drop table if exists renamed_slow_log; +--enable_warnings +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE general_log TO renamed_general_log; +--error ER_CANT_RENAME_LOG_TABLE +RENAME TABLE slow_log TO renamed_slow_log; + +use test; +flush tables with read lock; +unlock tables; + SET @@session.long_query_time= @old_long_query_time; SET @@global.log_output= @old_log_output; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index e5c7a415170..6a5736913b4 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -677,4 +677,15 @@ SET t3.a = 0; DROP TABLE t1, t2, t3; SET SESSION sql_safe_updates = DEFAULT; +--echo # +--echo # Bug#52157 various crashes and assertions with multi-table update, stored function +--echo # + +CREATE FUNCTION f1 () RETURNS BLOB RETURN 1; +CREATE TABLE t1 (f1 DATE); +INSERT INTO t1 VALUES('2001-01-01'); +UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; +DROP FUNCTION f1; +DROP TABLE t1; + --echo end of tests diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index 9df25d8e084..4f634cdda05 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -414,4 +414,147 @@ drop table t1; --exec $MYSQL --skip-column-names --vertical test -e "select 1 as a" --echo + +--echo # +--echo # Bug #54899: --one-database option cannot handle DROP/CREATE DATABASE +--echo # commands. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/bug54899.sql +DROP DATABASE connected_db; +CREATE DATABASE connected_db; +USE connected_db; +CREATE TABLE `table_in_connected_db`(a INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/bug54899.sql +USE connected_db; +SHOW TABLES; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/bug54899.sql + +--echo + +--echo # +--echo # Testing --one-database option +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +USE test; +# Following statements should be filtered. +CREATE TABLE connected_db.t2 (i INT); +CREATE TABLE t2 (i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN connected_db; +SHOW TABLES IN test; +USE test; +DROP TABLE t1; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE DATABASE test1; +USE test1; +USE test1; +# Following statements should be filtered. +CREATE TABLE connected_db.t1 (i INT); +EOF + +--exec $MYSQL --one-database test < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN test; +SHOW TABLES IN test1; +DROP DATABASE test1; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option followed by the execution of +--echo # connect command. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +CONNECT test; +CREATE TABLE connected_db.t2 (i INT); +CREATE TABLE t2 (i INT); +USE connected_db; +# Following statements should be filtered. +CREATE TABLE connected_db.t3 (i INT); +CREATE TABLE t3 (i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN connected_db; +SHOW TABLES IN test; +DROP TABLE test.t1; +DROP TABLE test.t2; +DROP DATABASE connected_db; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option with no database specified +--echo # at command-line. +--echo # +--write_file $MYSQLTEST_VARDIR/tmp/one_db.sql +# All following statements should be filtered. +CREATE TABLE t1 (i INT); +CREATE TABLE test.t1 (i INT); +USE test; +CREATE TABLE test.t2 (i INT); +CREATE TABLE t2 (i INT); +EOF + +--exec $MYSQL --one-database < $MYSQLTEST_VARDIR/tmp/one_db.sql +SHOW TABLES IN test; +--remove_file $MYSQLTEST_VARDIR/tmp/one_db.sql + +--echo + +--echo # +--echo # Checking --one-database option with non_existent_db +--echo # specified with USE command +--echo # + +# CASE 1 : When 'connected_db' database exists and passed at commandline. +--write_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql +CREATE TABLE `table_in_connected_db`(i INT); +USE non_existent_db; +# Following statement should be filtered out. +CREATE TABLE `table_in_non_existent_db`(i INT); +EOF + +# CASE 2 : When 'connected_db' database exists but dropped and recreated in +# load file. +--write_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql +DROP DATABASE connected_db; +CREATE DATABASE connected_db; +USE non_existent_db; +# Following statements should be filtered out. +CREATE TABLE `table_in_non_existent_db`(i INT); +USE connected_db; +# Following statements should not be filtered out. +CREATE TABLE `table_in_connected_db`(i INT); +EOF + +CREATE DATABASE connected_db; +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_1.sql +SHOW TABLES IN connected_db; +--echo +--exec $MYSQL --one-database connected_db < $MYSQLTEST_VARDIR/tmp/one_db_2.sql +SHOW TABLES IN connected_db; +DROP DATABASE connected_db; + +--remove_file $MYSQLTEST_VARDIR/tmp/one_db_1.sql +--remove_file $MYSQLTEST_VARDIR/tmp/one_db_2.sql + +--echo --echo End of tests diff --git a/mysql-test/t/mysqlbinlog-innodb.test b/mysql-test/t/mysqlbinlog-innodb.test new file mode 100644 index 00000000000..49702e8db38 --- /dev/null +++ b/mysql-test/t/mysqlbinlog-innodb.test @@ -0,0 +1,31 @@ +-- source include/have_binlog_format_statement.inc +-- source include/have_log_bin.inc +-- source include/have_innodb.inc + +# +# MBug#702303: Spurious `use` statements in output from mysqlbinlog --rewrite-db="a->b" +# +let $MYSQLD_DATADIR= `select @@datadir`; +SET TIMESTAMP=1000000000; +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=innodb; +CREATE DATABASE test2; + +RESET MASTER; +USE test2; +BEGIN; +USE test; +INSERT INTO t1 VALUES (1); +USE test2; +COMMIT; +BEGIN; +USE test; +INSERT INTO t1 VALUES (2); +USE test2; +COMMIT; +USE test; +SELECT * FROM t1 ORDER BY a; +FLUSH LOGS; +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form +--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 --short-form --rewrite-db="test->foo" --rewrite-db="test2->bar" +DROP DATABASE test2; +DROP TABLE t1; diff --git a/mysql-test/t/mysqlbinlog-master.opt b/mysql-test/t/mysqlbinlog-master.opt index ac1a87c73b3..a9f4a6010d8 100644 --- a/mysql-test/t/mysqlbinlog-master.opt +++ b/mysql-test/t/mysqlbinlog-master.opt @@ -1 +1,2 @@ --max-binlog-size=4096 +--force-restart diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 783708cc3b2..d5dd3052269 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -474,3 +474,30 @@ diff_files $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn $MYSQLTEST_VARDIR/tmp/mysqlbin # Cleanup for this part of test remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn.empty; remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn; + +# +# BUG#50914 +# This test verifies if the approach of the mysqlbinlog prints +# "use $database" statements to its output stream will cause +# "No Database Selected" error when dropping and recreating +# that database. +# +RESET MASTER; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP DATABASE test1; +CREATE DATABASE test1; +USE test1; +CREATE TABLE t1(id int); +DROP TABLE t1; +DROP DATABASE test1; +let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1); +FLUSH LOGS; + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +exec $MYSQL_BINLOG $MYSQLD_DATADIR/$master_binlog | $MYSQL test 2>&1; + +let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1); +source include/show_binlog_events.inc; + diff --git a/mysql-test/t/mysqltest.test b/mysql-test/t/mysqltest.test index 760391f5bab..2e04d96aaab 100644 --- a/mysql-test/t/mysqltest.test +++ b/mysql-test/t/mysqltest.test @@ -862,6 +862,13 @@ let $var2= `failing query`; echo $var2; EOF +create table t1 (a varchar(100)); +insert into t1 values ('`select 42`'); +let $a= `select * from t1`; +# This should output `select 42`, not evaluate it again to 42 +echo $a; +drop table t1; + --error 1 --exec $MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/let.sql 2>&1 @@ -1139,6 +1146,11 @@ if (!$counter) { echo Counter is not 0, (counter=10); } +if (! $counter) +{ + let $counter=5; +} +echo Counter should still be 10, is $counter; let $counter=0; if($counter) { @@ -1148,6 +1160,10 @@ if (!$counter) { echo Counter is not 0, (counter=0); } +if (! $counter) +{ + echo Not space var works; +} # ---------------------------------------------------------------------------- # Test if with some non-numerics @@ -1932,6 +1948,7 @@ EOF cat_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; remove_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp; +--replace_regex /my_errno=[0-9]*/(my_errno)/ --error 1 --exec echo "cat_file non_existing_file;" | $MYSQL_TEST 2>&1 @@ -2512,6 +2529,8 @@ write_file $MYSQLTEST_VARDIR/tmp/testdir/file1.txt; hello EOF +# Verify that --replace_result also work on list_files +--replace_result file REPLACED_FILE list_files $MYSQLTEST_VARDIR/tmp/testdir; # list_files gets the directory list before creating the new file list_files_write_file $MYSQLTEST_VARDIR/tmp/testdir/file2.txt $MYSQLTEST_VARDIR/tmp/testdir *; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index e0e3f2af396..e0d420f2558 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -1823,15 +1823,16 @@ commit; drop table t1; # -# BUG#32272: partition crash 1: enum column +# BUG#32772: partition crash 1: enum column # +# Note that month(int_col) is disallowed after bug#54483. create table t1 ( c0 int, c1 bigint, c2 set('sweet'), key (c2,c1,c0), key(c0) -) engine=myisam partition by hash (month(c0)) partitions 5; +) engine=myisam partition by hash (c0) partitions 5; --disable_warnings insert ignore into t1 set c0 = -6502262, c1 = 3992917, c2 = 35019; diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index d3f10628254..b222b02252b 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -11,6 +11,670 @@ drop table if exists t1; let $MYSQLD_DATADIR= `SELECT @@datadir`; --echo # +--echo # Bug#54483: valgrind errors when making warnings for multiline inserts +--echo # into partition +--echo # +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARBINARY(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a CHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIMESTAMP) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +CREATE TABLE t1 (a DATE) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +INSERT INTO t1 VALUES ('test'),('a'),('5'); +SHOW WARNINGS; +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY RANGE (DAYOFWEEK(a)) +(PARTITION a1 VALUES LESS THAN (60)); +SHOW WARNINGS; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_DAYS(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TO_DAYS(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFMONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFMONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFMONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFMONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MONTH(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MONTH(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MONTH(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MONTH(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (DAYOFYEAR(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (DAYOFYEAR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (DAYOFYEAR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (DAYOFYEAR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (HOUR(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (HOUR(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (HOUR(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (HOUR(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MINUTE(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MINUTE(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MINUTE(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MINUTE(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (QUARTER(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (QUARTER(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (QUARTER(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (QUARTER(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (SECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (SECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (SECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (SECOND(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (YEARWEEK(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (YEARWEEK(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (YEARWEEK(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (YEARWEEK(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (WEEKDAY(a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (WEEKDAY(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (WEEKDAY(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (WEEKDAY(a)); +--echo # TO_SECONDS() is added in 5.5. + +--error ER_PARSE_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TO_SECONDS(a)); +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a TIME) +#PARTITION BY HASH (TO_SECONDS(a)); +#CREATE TABLE t1 (a DATE) +#PARTITION BY HASH (TO_SECONDS(a)); +#DROP TABLE t1; +#CREATE TABLE t1 (a DATETIME) +#PARTITION BY HASH (TO_SECONDS(a)); +#DROP TABLE t1; +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a VARCHAR(10)) +#PARTITION BY HASH (TO_SECONDS(a)); +#--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +#CREATE TABLE t1 (a INT) +#PARTITION BY HASH (TO_SECONDS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (FROM_DAYS(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TO_DAYS(FROM_DAYS(a))); +--error ER_PARTITION_FUNC_NOT_ALLOWED_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (FROM_DAYS(a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (MICROSECOND(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (MICROSECOND(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (MICROSECOND(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (MICROSECOND(a)); +--echo # Bug#57071 +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int) +PARTITION BY LIST (EXTRACT(WEEK FROM date) % 3) +(PARTITION p0 VALUES IN (0), + PARTITION p1 VALUES IN (1), + PARTITION p2 VALUES IN (2)); +CREATE TABLE t1 +(`date` date, + `extracted_week` int, + `yearweek` int, + `week` int, + `default_week_format` int); +SET @old_default_week_format := @@default_week_format; +SET default_week_format = 0; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 1; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 2; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 3; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 4; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 5; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 6; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SET default_week_format = 7; +INSERT INTO t1 VALUES ('2000-01-01', EXTRACT(WEEK FROM '2000-01-01'), YEARWEEK('2000-01-01'), WEEK('2000-01-01'), @@default_week_format); +SELECT * FROM t1; +SET default_week_format = @old_default_week_format; +DROP TABLE t1; + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(YEAR_MONTH FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(QUARTER FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MONTH FROM a)); + +--echo # EXTRACT(WEEK...) is disallowed, see bug#57071. +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(WEEK FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_HOUR FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MINUTE FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(DAY_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(HOUR_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(MINUTE_MICROSECOND FROM a)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (EXTRACT(SECOND_MICROSECOND FROM a)); + +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a TIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +CREATE TABLE t1 (a DATE, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME, b DATE) +PARTITION BY HASH (DATEDIFF(a, b)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE, b VARCHAR(10)) +PARTITION BY HASH (DATEDIFF(a, b)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT, b DATETIME) +PARTITION BY HASH (DATEDIFF(a, b)); + +CREATE TABLE t1 (a TIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a DATE) +PARTITION BY HASH (TIME_TO_SEC(a)); +CREATE TABLE t1 (a DATETIME) +PARTITION BY HASH (TIME_TO_SEC(a)); +DROP TABLE t1; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a VARCHAR(10)) +PARTITION BY HASH (TIME_TO_SEC(a)); +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (TIME_TO_SEC(a)); + + +--echo # --echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) --echo # CREATE TABLE t1 (a INT) PARTITION BY HASH (a); diff --git a/mysql-test/t/partition_federated.test b/mysql-test/t/partition_federated.test deleted file mode 100644 index 0fe692ecd01..00000000000 --- a/mysql-test/t/partition_federated.test +++ /dev/null @@ -1,21 +0,0 @@ -# -# Tests for partitioned FEDERATED -# --- source include/have_partition.inc --- source include/not_embedded.inc --- source suite/federated/have_federated_db.inc - ---disable_warnings -drop table if exists t1; ---enable_warnings - -# -# Bug #22451 Partitions: duplicate results with engine=federated -# - ---error ER_PARTITION_MERGE_ERROR -create table t1 (s1 int) engine=federated -connection='mysql://root@localhost/federated/t1' partition by list (s1) -(partition p1 values in (1), partition p2 values in (2)); - ---echo End of 5.1 tests diff --git a/mysql-test/t/partition_innodb_plugin.test b/mysql-test/t/partition_innodb_plugin.test index 04c72127394..626e5d19b99 100644 --- a/mysql-test/t/partition_innodb_plugin.test +++ b/mysql-test/t/partition_innodb_plugin.test @@ -1,5 +1,74 @@ --source include/have_partition.inc ---source include/have_innodb.inc +--source include/have_innodb_plugin.inc +# Remove the line below when bug#53307 is solved. +--source include/not_valgrind.inc + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + +call mtr.add_suppression("nnoDB: Error: table `test`.`t1` .* Partition.* InnoDB internal"); +--echo # +--echo # Bug#55091: Server crashes on ADD PARTITION after a failed attempt +--echo # +SET @old_innodb_file_format_check = @@global.innodb_file_format_check; +SET @old_innodb_file_format = @@global.innodb_file_format; +SET @old_innodb_file_per_table = @@global.innodb_file_per_table; +SET @old_innodb_strict_mode = @@global.innodb_strict_mode; +SET @@global.innodb_file_format = Barracuda, +@@global.innodb_file_per_table = ON, +@@global.innodb_strict_mode = ON; + +--echo # Connection con1 +--connect(con1,localhost,root,,) + +CREATE TABLE t1 (id INT NOT NULL +PRIMARY KEY, +user_num CHAR(10) +) ENGINE = InnoDB +KEY_BLOCK_SIZE=4 +PARTITION BY HASH(id) PARTITIONS 1; + +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test +SHOW CREATE TABLE t1; + +SET GLOBAL innodb_file_per_table = OFF; + +--disconnect con1 +--connect(con2,localhost,root,,) +--echo # Connection con2 + +LOCK TABLE t1 WRITE; + +--echo # ALTER fails because COMPRESSED/KEY_BLOCK_SIZE +--echo # are incompatible with innodb_file_per_table = OFF; + +--error ER_GET_ERRNO +ALTER TABLE t1 ADD PARTITION PARTITIONS 1; + +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test +--echo # This SET is not needed to reproduce the bug, +--echo # it is here just to make the test case more realistic +SET innodb_strict_mode = OFF; + +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--replace_result #p# #P# +--list_files $MYSQLD_DATADIR/test + +# really bug#56172 +ALTER TABLE t1 REBUILD PARTITION p0; + +UNLOCK TABLES; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--disconnect con2 +--connection default +--echo # Connection default +SET @@global.innodb_strict_mode = @old_innodb_strict_mode; +SET @@global.innodb_file_format = @old_innodb_file_format; +SET @@global.innodb_file_per_table = @old_innodb_file_per_table; +SET @@global.innodb_file_format_check = @old_innodb_file_format_check; # # Bug#32430 - show engine innodb status causes errors diff --git a/mysql-test/t/plugin_not_embedded.test b/mysql-test/t/plugin_not_embedded.test index 11350e8c896..3e3bd6e86ca 100644 --- a/mysql-test/t/plugin_not_embedded.test +++ b/mysql-test/t/plugin_not_embedded.test @@ -18,3 +18,15 @@ UNINSTALL PLUGIN example; disconnect con1; connection default; DROP USER bug51770@localhost; + +# +# BUG#58246: INSTALL PLUGIN not secure & crashable +# +# The bug consisted of not recognizing / on Windows, so checking / on +# all platforms should cover this case. + +let $path = `select CONCAT_WS('/', '..', '$HA_EXAMPLE_SO')`; +--replace_regex /\.dll/.so/ +--error ER_UDF_NO_PATHS +eval INSTALL PLUGIN example SONAME '$path'; + diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test index 8aa0791e265..fe52632c784 100644 --- a/mysql-test/t/sp-bugs.test +++ b/mysql-test/t/sp-bugs.test @@ -101,4 +101,41 @@ CALL p1 (); DROP TABLE t1; DROP PROCEDURE p1; +--echo # +--echo # Bug#54375: Error in stored procedure leaves connection +--echo # in different default schema +--echo # + +--disable_warnings +SET @@SQL_MODE = 'STRICT_ALL_TABLES'; +DROP DATABASE IF EXISTS db1; +CREATE DATABASE db1; +USE db1; +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (c1 int NOT NULL PRIMARY KEY); +INSERT INTO t1 VALUES (1); +DELIMITER $$; +CREATE FUNCTION f1 ( + some_value int +) +RETURNS smallint +DETERMINISTIC +BEGIN + INSERT INTO t1 SET c1 = some_value; + RETURN(LAST_INSERT_ID()); +END$$ +DELIMITER ;$$ +DROP DATABASE IF EXISTS db2; +CREATE DATABASE db2; +--enable_warnings +USE db2; +SELECT DATABASE(); +--error ER_DUP_ENTRY +SELECT db1.f1(1); +SELECT DATABASE(); +USE test; +DROP FUNCTION db1.f1; +DROP TABLE db1.t1; +DROP DATABASE db1; +DROP DATABASE db2; --echo End of 5.1 tests diff --git a/mysql-test/t/subselect4.test b/mysql-test/t/subselect4.test index a896394fde6..8943c394579 100644 --- a/mysql-test/t/subselect4.test +++ b/mysql-test/t/subselect4.test @@ -161,6 +161,16 @@ SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 ); DROP TABLE t1, t2, t3, t4, t5; --echo # +--echo # Bug#58207: invalid memory reads when using default column value and +--echo # tmptable needed +--echo # +CREATE TABLE t(a VARCHAR(245) DEFAULT +'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'); +INSERT INTO t VALUES (''),(''),(''),(''),(''),(''),(''),(''),(''),(''),(''); +SELECT * FROM (SELECT default(a) FROM t GROUP BY a) d; +DROP TABLE t; + +--echo # --echo # End of 5.1 tests. --echo # diff --git a/mysql-test/t/type_blob.test b/mysql-test/t/type_blob.test index 460da1c1614..4e097edf73d 100644 --- a/mysql-test/t/type_blob.test +++ b/mysql-test/t/type_blob.test @@ -612,3 +612,19 @@ explain select convert(1, binary(4294967296)); explain select convert(1, binary(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)); --echo End of 5.0 tests + +--echo # Bug #52160: crash and inconsistent results when grouping +--echo # by a function and column + +CREATE FUNCTION f1() RETURNS TINYBLOB RETURN 1; + +CREATE TABLE t1(a CHAR(1)); +INSERT INTO t1 VALUES ('0'), ('0'); + +SELECT COUNT(*) FROM t1 GROUP BY f1(), a; + +DROP FUNCTION f1; +DROP TABLE t1; + +--echo End of 5.1 tests + diff --git a/mysql-test/t/type_year.test b/mysql-test/t/type_year.test index d8da4ccc82c..1a9e66478e1 100644 --- a/mysql-test/t/type_year.test +++ b/mysql-test/t/type_year.test @@ -150,5 +150,15 @@ SELECT ta.y AS ta_y, ta.s, tb.y AS tb_y, tb.s FROM t1 ta, t1 tb HAVING ta_y = tb DROP TABLE t1; --echo # +--echo # Bug #59211: Select Returns Different Value for min(year) Function +--echo # + +CREATE TABLE t1(c1 YEAR(4)); +INSERT INTO t1 VALUES (1901),(2155),(0000); +SELECT * FROM t1; +SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +DROP TABLE t1; + +--echo # --echo End of 5.1 tests diff --git a/mysql-test/t/user_var.test b/mysql-test/t/user_var.test index 4f27866de23..efaf8afd91e 100644 --- a/mysql-test/t/user_var.test +++ b/mysql-test/t/user_var.test @@ -346,4 +346,23 @@ FROM t1 GROUP BY a LIMIT 1; DROP TABLE t1; +# +# BUG#56138 "valgrind errors about overlapping memory when +# double-assigning same variable" +# + +select @v:=@v:=sum(1) from dual; + +# +# Bug #57187: more user variable fun with multiple assignments and +# comparison in query +# + +CREATE TABLE t1(a DECIMAL(31,21)); +INSERT INTO t1 VALUES (0); + +SELECT (@v:=a) <> (@v:=1) FROM t1; + +DROP TABLE t1; + --echo End of 5.1 tests diff --git a/mysql-test/t/variables-big.test b/mysql-test/t/variables-big.test index 2df0222c9d5..2c0f55032a5 100644 --- a/mysql-test/t/variables-big.test +++ b/mysql-test/t/variables-big.test @@ -3,6 +3,10 @@ # --source include/big_test.inc +# The test would allocate and initialize 5GB of memory +# if compiled with debug. It can take a lot of time +# of for paging/swapping. +--source include/not_debug.inc # # Bug#27322 failure to allocate transaction_prealloc_size causes crash @@ -37,28 +41,28 @@ --disable_warnings SET SESSION transaction_prealloc_size=1024*1024*1024*1; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> # Embedded server is hardcoded to show "Writing to net" as STATE. --replace_result "Writing to net" "NULL" --replace_regex /localhost[:0-9]*/localhost/ SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*2; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" --replace_regex /localhost[:0-9]*/localhost/ SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*3; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" --replace_regex /localhost[:0-9]*/localhost/ SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*4; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" --replace_regex /localhost[:0-9]*/localhost/ SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*5; ---replace_column 1 <Id> 6 <Time> +--replace_column 1 <Id> 3 <Host> 6 <Time> --replace_result "Writing to net" "NULL" SHOW PROCESSLIST; --enable_warnings diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 3bd192f8cd1..eed5bd54dea 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1248,4 +1248,48 @@ SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size; SELECT @@skip_name_resolve; SHOW VARIABLES LIKE 'skip_name_resolve'; +--echo # +--echo # Bug #43233 : Some server variables are clipped during "update," +--echo # not "check" stage +--echo # + +SET @kbs=@@global.key_buffer_size; +SET @kcbs=@@global.key_cache_block_size; + +--echo throw errors in STRICT mode +SET SQL_MODE=STRICT_ALL_TABLES; + +# sys_var_ulonglong_ptr: sys_max_binlog_cache_size +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.max_binlog_cache_size=-1; + +# sys_var_thd_ha_rows: "max_join_size" et al. +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.max_join_size=0; + +# sys_var_key_buffer_size: "key_buffer_size" +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE +SET @@global.key_buffer_size=0; + +# sys_var_key_cache_long: "key_cache_block_size" et al. +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.key_cache_block_size=0; + +--echo throw warnings in default mode +SET SQL_MODE=DEFAULT; + +SET @@global.max_binlog_cache_size=-1; +SET @@global.max_join_size=0; +# this is an exception. since this is a new error/warning, let's stay +# compatible with the upcoming 5.6. +--error ER_WARN_CANT_DROP_DEFAULT_KEYCACHE +SET @@global.key_buffer_size=0; +SET @@global.key_cache_block_size=0; + +# cleanup +SET @@global.max_binlog_cache_size=DEFAULT; +SET @@global.max_join_size=DEFAULT; +SET @@global.key_buffer_size=@kbs; +SET @@global.key_cache_block_size=@kcbs; + --echo End of 5.1 tests diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index d683a87444e..d0295543d16 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3925,6 +3925,22 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#57703 create view cause Assertion failed: 0, file .\item_subselect.cc, line 846 +--echo # + +CREATE TABLE t1(a int); +CREATE VIEW v1 AS SELECT 1 FROM t1 GROUP BY +SUBSTRING(1 FROM (SELECT 3 FROM t1 WHERE a >= ANY(SELECT 1))); +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # Bug#57352 valgrind warnings when creating view +--echo # +CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f; +DROP VIEW v1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/view_grant.test b/mysql-test/t/view_grant.test index ba603bde7f8..21c6f376f8a 100644 --- a/mysql-test/t/view_grant.test +++ b/mysql-test/t/view_grant.test @@ -1503,8 +1503,6 @@ SHOW CREATE VIEW v1; DROP TABLE t1; DROP VIEW v1; -# Wait till we reached the initial number of concurrent sessions ---source include/wait_until_count_sessions.inc --echo # --echo # Bug #46019: ERROR 1356 When selecting from within another @@ -1546,3 +1544,145 @@ CREATE DEFINER=`unknown`@`unknown` SQL SECURITY DEFINER VIEW v1 AS SELECT 1; --error ER_NO_SUCH_USER LOCK TABLES v1 READ; DROP VIEW v1; + + +--echo # +--echo # Bug #58499 "DEFINER-security view selecting from INVOKER-security view +--echo # access check wrong". +--echo # +--echo # Check that we correctly handle privileges for various combinations +--echo # of INVOKER and DEFINER-security views using each other. +--disable_warnings +DROP DATABASE IF EXISTS mysqltest1; +--enable_warnings +CREATE DATABASE mysqltest1; +USE mysqltest1; +CREATE TABLE t1 (i INT); +CREATE TABLE t2 (j INT); +INSERT INTO t1 VALUES (1); +INSERT INTO t2 VALUES (2); +--echo # +--echo # 1) DEFINER-security view uses INVOKER-security view (covers +--echo # scenario originally described in the bug report). +CREATE SQL SECURITY INVOKER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY INVOKER VIEW v1_uses_t2 AS SELECT * FROM t2; +CREATE USER 'mysqluser1'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser1'@'%'; +GRANT SELECT ON t1 TO 'mysqluser1'@'%'; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connect (mysqluser1, localhost, mysqluser1,,mysqltest1) +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +CREATE USER 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser2'@'%'; +GRANT SELECT ON t2 TO 'mysqluser2'@'%'; +GRANT CREATE VIEW ON mysqltest1.* TO 'mysqluser2'@'%'; +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connect (mysqluser2, localhost, mysqluser2,,mysqltest1) +--echo # The below statement should succeed thanks to suid nature of v2_uses_t1. +SELECT * FROM v2_uses_t1; +--echo # The below statement should fail due to suid nature of v2_uses_t2. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 2) INVOKER-security view uses INVOKER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY INVOKER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +GRANT SELECT ON v2_uses_t1 TO 'mysqluser1'@'%'; +GRANT SELECT ON v2_uses_t2 TO 'mysqluser1'@'%'; +GRANT SELECT ON v1_uses_t1 TO 'mysqluser2'@'%'; +GRANT SELECT ON v1_uses_t2 TO 'mysqluser2'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +--echo # For both versions of 'v2' 'mysqluser1' privileges should be used. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # And now for both versions of 'v2' 'mysqluser2' privileges should +--echo # be used. +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t1; +SELECT * FROM v2_uses_t2; +--echo # +--echo # 3) INVOKER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v1_uses_t1, v1_uses_t2; +--echo # To be able create 'v1_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser1'. +--connection mysqluser1 +CREATE SQL SECURITY DEFINER VIEW v1_uses_t1 AS SELECT * FROM t1; +CREATE SQL SECURITY DEFINER VIEW v1_uses_t2 AS SELECT * FROM t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Due to suid nature of v1_uses_t1 and v1_uses_t2 the first +--echo # select should succeed and the second select should fail. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; +--echo # +--echo # 4) DEFINER-security view uses DEFINER-security view. +--echo # +--echo # Connection 'default'. +--connection default +DROP VIEW v2_uses_t1, v2_uses_t2; +--echo # To be able create 'v2_uses_t2' we also need select on t2. +GRANT SELECT ON t2 TO 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +CREATE SQL SECURITY DEFINER VIEW v2_uses_t1 AS SELECT * FROM v1_uses_t1; +CREATE SQL SECURITY DEFINER VIEW v2_uses_t2 AS SELECT * FROM v1_uses_t2; +--echo # +--echo # Connection 'default'. +--connection default +--echo # Make 'mysqluser1' unable to access t2. +REVOKE SELECT ON t2 FROM 'mysqluser1'@'%'; +--echo # +--echo # Connection 'mysqluser2'. +--connection mysqluser2 +--echo # Again privileges of creator of innermost views should apply. +SELECT * FROM v2_uses_t1; +--error ER_VIEW_INVALID +SELECT * FROM v2_uses_t2; + +--disconnect mysqluser1 +--disconnect mysqluser2 +--connection default +USE test; +DROP DATABASE mysqltest1; +DROP USER 'mysqluser1'@'%'; +DROP USER 'mysqluser2'@'%'; + + +# Wait till we reached the initial number of concurrent sessions +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 6e7d38cdfca..416f1fef0c5 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -617,4 +617,28 @@ FROM t1 ORDER BY t1.id; DROP TABLE t1; + +--echo # +--echo # Bug#57257 Replace(ExtractValue(...)) causes MySQL crash +--echo # +SET NAMES utf8; +SELECT REPLACE(EXTRACTVALUE('1', '/a'),'ds',''); + + +--echo # +--echo # Bug #57820 extractvalue crashes +--echo # +SELECT AVG(DISTINCT EXTRACTVALUE((''),('$@k'))); + + +--echo # +--echo # Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0 +--echo # + +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT UPDATEXML(NULL, (LPAD(0.1111E-15, '2011', 1)), 1); +--error ER_ILLEGAL_VALUE_FOR_TYPE +SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); + + --echo End of 5.1 tests |