diff options
Diffstat (limited to 'mysql-test/t')
54 files changed, 1565 insertions, 314 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 5d71eead642..38d0d08808a 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1159,3 +1159,20 @@ CREATE TABLE db1.t1 (bar TINYTEXT, KEY (bar(100))); ALTER TABLE db1.t1 ADD baz INT; DROP DATABASE db1; + + +--echo # +--echo # Bug#11938039 RE-EXECUTION OF FRM-ONLY ALTER TABLE WITH RENAME +--echo # CLAUSE FAILS OR ABORTS SERVER. +--echo # +--disable_warnings +drop table if exists t1; +--enable_warnings +create table t1 (a int); +prepare stmt1 from 'alter table t1 alter column a set default 1, rename to t2'; +execute stmt1; +rename table t2 to t1; +--echo # The below statement should succeed and not emit error or abort server. +execute stmt1; +deallocate prepare stmt1; +drop table t2; diff --git a/mysql-test/t/archive_plugin.test b/mysql-test/t/archive_plugin.test index 567a0a58ce7..7d9b0ea065f 100644 --- a/mysql-test/t/archive_plugin.test +++ b/mysql-test/t/archive_plugin.test @@ -20,6 +20,14 @@ CREATE TABLE t1(a int) ENGINE=ARCHIVE; DROP TABLE t1; +# This dummy statement is required for --ps-protocol mode. +# The thing is that last prepared statement is "cached" in mysqltest.cc +# (unless "reconnect" is enabled, and that's not the case here). +# This statement forces mysqltest.cc to close prepared "DROP TABLE t1". +# Otherwise, the plugin can not be uninstalled because there is an active +# prepared statement using it. +SELECT 1; + UNINSTALL PLUGIN archive; --error ER_SP_DOES_NOT_EXIST diff --git a/mysql-test/t/blackhole_plugin.test b/mysql-test/t/blackhole_plugin.test index 1de5b2d0499..448104bed2b 100644 --- a/mysql-test/t/blackhole_plugin.test +++ b/mysql-test/t/blackhole_plugin.test @@ -20,6 +20,14 @@ CREATE TABLE t1(a int) ENGINE=BLACKHOLE; DROP TABLE t1; +# This dummy statement is required for --ps-protocol mode. +# The thing is that last prepared statement is "cached" in mysqltest.cc +# (unless "reconnect" is enabled, and that's not the case here). +# This statement forces mysqltest.cc to close prepared "DROP TABLE t1". +# Otherwise, the plugin can not be uninstalled because there is an active +# prepared statement using it. +SELECT 1; + UNINSTALL PLUGIN blackhole; --error ER_SP_DOES_NOT_EXIST UNINSTALL PLUGIN blackhole; diff --git a/mysql-test/t/bootstrap.test b/mysql-test/t/bootstrap.test index e98afb81ff1..5b432653e45 100644 --- a/mysql-test/t/bootstrap.test +++ b/mysql-test/t/bootstrap.test @@ -49,3 +49,15 @@ remove_file $MYSQLTEST_VARDIR/tmp/long_query.sql; set global max_allowed_packet=@my_max_allowed_packet; drop table t1; +--echo End of 5.1 tests + +--echo # +--echo # Bug #11766306: 59393: HAVE_INNODB=YES WHEN MYSQLD +--echo # STARTED WITH --SKIP-INNODB +--echo # + +# need the --skip-innodb option present for the test to succeed +SHOW VARIABLES LIKE 'have_innodb'; +SELECT SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb'; + +--echo End of 5.5 tests diff --git a/mysql-test/t/crash_commit_before.test b/mysql-test/t/crash_commit_before.test index e3dba58d4df..6e36d2345e1 100644 --- a/mysql-test/t/crash_commit_before.test +++ b/mysql-test/t/crash_commit_before.test @@ -1,6 +1,8 @@ -- source include/not_embedded.inc # Don't test this under valgrind, memory leaks will occur --source include/not_valgrind.inc +# Avoid CrashReporter popup on Mac +--source include/not_crashrep.inc # Binary must be compiled with debug for crash to occur --source include/have_debug.inc diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index b8aae2eae40..5d1acf107d7 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -144,5 +144,20 @@ SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); --source include/ctype_numconv.inc --echo # +--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +--echo # +# Test latin1 client erroneously started with --default-character-set=utf8 +# EXPLAIN output should still be pretty readable. +# We're using 'ó' (\xC3\xB3) as a magic sequence: +# - it's "LATIN CAPITAL LETTER A WITH TILDE ABOVE + SUPERSCRIPT 3" in latin1 +# - it's "LATIN SMALL LETTER O WITH ACUTE ABOVE" in utf8. +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +# Test normal latin1 +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 2aea21afe68..a519a417192 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1550,6 +1550,16 @@ SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); DROP TABLE t1; +--echo # +--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +--echo # +# Emulate utf8 client erroneously started with --default-character-set=latin1, +# as in the bug report. EXPLAIN output should still be pretty readable +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ' AS u; +# Test normal utf8 +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ'; --echo # --echo # End of 5.5 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 985493481e9..063bbb9ce4b 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -16,3 +16,4 @@ read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested create-big : Bug#37248 2010-11-15 mattiasj was not tested +archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 8d9959f1b0a..9432e64e032 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -1221,6 +1221,21 @@ SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS; DROP EVENT ev1; SET GLOBAL server_id = @old_server_id; +# +# Bug#11751148: show events shows events in other schema +# + +CREATE DATABASE event_test12; +USE event_test12; +CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +CREATE DATABASE event_test1; +USE event_test1; +# Following show events should not show ev1 +SHOW EVENTS; +DROP DATABASE event_test1; +DROP DATABASE event_test12; + + ########################################################################### # # End of tests diff --git a/mysql-test/t/file_contents.test b/mysql-test/t/file_contents.test index 2a112e14495..33cd65fb2b4 100644 --- a/mysql-test/t/file_contents.test +++ b/mysql-test/t/file_contents.test @@ -10,9 +10,10 @@ --perl print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n"; -$dir_docs = $ENV{'MYSQL_BINDIR'}; -if($dir_docs =~ m|/usr/|) { +$dir_bin = $ENV{'MYSQL_BINDIR'}; +if ($dir_bin =~ m|/usr/|) { # RPM package + $dir_docs = $dir_bin; $dir_docs =~ s|/lib|/share/doc|; if(-d "$dir_docs/packages/MySQL-server") { # SuSE @@ -21,8 +22,19 @@ if($dir_docs =~ m|/usr/|) { # RedHat: version number in directory name $dir_docs = glob "$dir_docs/MySQL-server*"; } +} elsif ($dir_bin =~ m|/usr$|) { + # RPM build during development + $dir_docs = "$dir_bin/share/doc"; + if(-d "$dir_docs/packages/MySQL-server") { + # SuSE + $dir_docs = "$dir_docs/packages/MySQL-server"; + } else { + # RedHat: version number in directory name + $dir_docs = glob "$dir_docs/MySQL-server*"; + } } else { # tar.gz package, Windows, or developer work (in BZR) + $dir_docs = $dir_bin; $dir_docs =~ s|/lib||; if(-d "$dir_docs/docs") { $dir_docs = "$dir_docs/docs"; # package @@ -32,7 +44,7 @@ if($dir_docs =~ m|/usr/|) { } $found_version = "No line 'MySQL source #.#.#'"; $found_revision = "No line 'revision-id: .....'"; -open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs'\n"; +open(I_SRC,"<","$dir_docs/INFO_SRC") or print "Cannot open 'INFO_SRC' in '$dir_docs' (starting from bindir '$dir_bin')\n"; while(defined ($line = <I_SRC>)) { if ($line =~ m|^MySQL source \d\.\d\.\d+|) {$found_version = "Found MySQL version number";} if ($line =~ m|^revision-id: .*@.*-2\d{13}-\w+$|) {$found_revision = "Found BZR revision id";} @@ -41,7 +53,7 @@ close I_SRC; print "INFO_SRC: $found_version / $found_revision\n"; $found_compiler = "No line about compiler information"; $found_features = "No line 'Feature flags'"; -open(I_BIN,"<","$dir_docs/INFO_BIN") or print "Cannot open 'INFO_BIN' in '$dir_docs'\n"; +open(I_BIN,"<","$dir_docs/INFO_BIN") or print "Cannot open 'INFO_BIN' in '$dir_docs' (starting from bindir '$dir_bin')\n"; while(defined ($line = <I_BIN>)) { # "generator" on Windows, "flags" on Unix: if (($line =~ m| Compiler / generator used: |) || diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 944c9c43019..52ee6d2cf87 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -644,3 +644,27 @@ disconnect con2; --source include/wait_until_disconnected.inc connection default; drop tables t1, t2; + + +--echo # +--echo # Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads +--echo # to assert failure. +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT); +FLUSH TABLES t1 WITH READ LOCK; + +# All these triggered the assertion +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +FLUSH TABLES; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +ALTER TABLE t1 COMMENT 'test'; + +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/t/flush_read_lock.test b/mysql-test/t/flush_read_lock.test index dbb1dd7cb49..9da93dd40a1 100644 --- a/mysql-test/t/flush_read_lock.test +++ b/mysql-test/t/flush_read_lock.test @@ -557,6 +557,8 @@ let $cleanup_stmt= ; --source include/check_ftwrl_compatible.inc deallocate prepare stmt1; +call mtr.add_suppression("Slave SQL.*Can.t execute the query because you have a conflicting read lock., Error_code: 1223"); + --echo # --echo # 9.2.b) EXECUTE for statement which is incompatible with FTWRL --echo # should be also incompatible. diff --git a/mysql-test/t/func_analyse.test b/mysql-test/t/func_analyse.test index 05f739bfd69..c77967a0cc9 100644 --- a/mysql-test/t/func_analyse.test +++ b/mysql-test/t/func_analyse.test @@ -1,6 +1,7 @@ # # Test of procedure analyse # +-- source include/have_innodb.inc --disable_warnings drop table if exists t1,t2; @@ -133,3 +134,26 @@ DROP TABLE t1; --echo End of 5.0 tests + +--echo # +--echo # Bug#11765202: Dbug_violation_helper::~Dbug_violation_helper(): Assertion `!_entered' failed. +--echo # + +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a VARCHAR(2) CHARSET UTF8 NOT NULL); +INSERT INTO t1 VALUES ('e'),('e'),('e-'); +SELECT * FROM t1 PROCEDURE ANALYSE(); +DROP TABLE t1; + +--echo # +--echo # Bug#11756242 48137: PROCEDURE ANALYSE() LEAKS MEMORY WHEN RETURNING NULL +--echo # + +CREATE TABLE t1(f1 INT) ENGINE=MYISAM; +CREATE TABLE t2(f2 INT) ENGINE=INNODB; +INSERT INTO t2 VALUES (1); +SELECT DISTINCTROW f1 FROM t1 NATURAL RIGHT OUTER JOIN t2 PROCEDURE ANALYSE(); +SELECT * FROM t2 LIMIT 1 PROCEDURE ANALYSE(); +DROP TABLE t1, t2; + +--echo End of 5.1 tests diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index a0527f70b25..e8309d68830 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1117,6 +1117,28 @@ SELECT RELEASE_LOCK('aaaaaaaaaaaaaaaaa'); --enable_result_log + +--echo # +--echo # Bug #11766094 - 59132: MIN() AND MAX() REMOVE UNSIGNEDNESS +--echo # + +CREATE TABLE t1 (a BIGINT UNSIGNED); +INSERT INTO t1 VALUES (18446668621106209655); +SELECT MAX(LENGTH(a)), LENGTH(MAX(a)), MIN(a), MAX(a), CONCAT(MIN(a)), CONCAT(MAX(a)) FROM t1; +DROP TABLE t1; + +--echo # +--echo # Bug #11766270 59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION +--echo # + +CREATE TABLE t1(f1 YEAR(4)); +INSERT INTO t1 VALUES (0000),(2001); +--enable_metadata +(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1); +--disable_metadata +DROP TABLE t1; + + --echo # --echo End of 5.1 tests diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test index 6efeb2866e6..08469b37967 100644 --- a/mysql-test/t/func_in.test +++ b/mysql-test/t/func_in.test @@ -555,5 +555,11 @@ SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP; DROP TABLE t1; --echo # +--echo # Bug #11766212 59270: NOT IN (YEAR( ... ), ... ) PRODUCES MANY VALGRIND WARNINGS +--echo # + +SELECT 1 IN (YEAR(FROM_UNIXTIME(NULL)) ,1); + +--echo # --echo End of 5.1 tests diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index e56b9c7d20d..687d96f8804 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -345,6 +345,15 @@ CREATE TABLE t1 SELECT CAST((CASE(('')) WHEN (CONVERT(1, CHAR(1))) THEN (('' / 1 SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # Bug#11764994 57900: CREATE TABLE .. SELECT ASSERTS SCALE >= 0 && PRECISION > 0 && SCALE <= PR +--echo # + +CREATE TABLE t1 SELECT CEIL(LINESTRINGFROMWKB(1) DIV NULL); +DROP TABLE t1; +CREATE TABLE t1 SELECT FLOOR(LINESTRINGFROMWKB(1) DIV NULL); +DROP TABLE t1; + --echo End of 5.1 tests --echo # @@ -500,3 +509,8 @@ SELECT ((@a:=@b:=1.0) div (@b:=@a:=get_format(datetime, 'usa'))); --echo # Bug #59498 div function broken in mysql-trunk --echo # SELECT 1 div null; + +--echo # +--echo # Bug #11792200 - DIVIDING LARGE NUMBERS CAUSES STACK CORRUPTIONS +--echo # +select (1.175494351E-37 div 1.7976931348623157E+308); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 294efa8caf1..3531864c860 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -97,3 +97,25 @@ SELECT CONVERT( a USING latin1 ) FROM t1; SELECT CONVERT( a USING latin1 ) FROM t2; DROP TABLE t1, t2; + +--echo # +--echo # BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5 +--echo # + +CREATE TABLE t1(days set('1','2','3','4','5','6','7')); +INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7'); + +--echo +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days); +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL); +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(7, days); +SELECT * FROM t1 WHERE FIND_IN_SET(8, days); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN; + +--echo +DROP TABLE t1; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index f53d90cef96..96a73a454c3 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -862,6 +862,38 @@ INSERT INTO t1 VALUES (''),(''); SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); DROP TABLE t1; +--echo # +--echo # Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ... +--echo # + +SELECT STR_TO_DATE(SPACE(2),'1'); + +--echo # +--echo # Bug#11765216 58154: UNINITIALIZED VARIABLE FORMAT IN STR_TO_DATE FUNCTION +--echo # + +SET GLOBAL SQL_MODE=''; +DO STR_TO_DATE((''), FROM_DAYS(@@GLOBAL.SQL_MODE)); +SET GLOBAL SQL_MODE=DEFAULT; + +--echo # +--echo # Bug#11766087 59125: VALGRIND UNINITIALISED VALUE WARNING IN ULL2DEC, LONGLONG2DECIMAL +--echo # + +SELECT FORMAT(YEAR(STR_TO_DATE('',GET_FORMAT(TIME,''))),1); + +--echo # +--echo # Bug#11766126 59166: ANOTHER DATETIME VALGRIND UNINITIALIZED WARNING +--echo # + +SELECT CAST((MONTH(FROM_UNIXTIME(@@GLOBAL.SQL_MODE))) AS BINARY(1025)); + +--echo # +--echo # Bug#11766124 59164: VALGRIND: UNINITIALIZED VALUE IN NUMBER_TO_DATETIME +--echo # + +SELECT ADDDATE(MONTH(FROM_UNIXTIME(NULL)),INTERVAL 1 HOUR); + --echo End of 5.1 tests --echo # @@ -888,4 +920,12 @@ SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1; SET storage_engine=NULL; --echo # +--echo # Bug #59686 crash in String::copy() with time data type +--echo # +SELECT min(timestampadd(month, 1>'', from_days('%Z'))); + +create table t1(a time); +insert into t1 values ('00:00:00'),('00:01:00'); +select 1 from t1 where 1 < some (select cast(a as datetime) from t1); +drop table t1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 845b976c031..1e1cb6c24dc 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1396,6 +1396,183 @@ DROP USER testuser@localhost; use test; --echo + +--echo # +--echo # Test for bug #36544 "DROP USER does not remove stored function +--echo # privileges". +--echo # +create database mysqltest1; +create function mysqltest1.f1() returns int return 0; +create procedure mysqltest1.p1() begin end; +--echo # +--echo # 1) Check that DROP USER properly removes privileges on both +--echo # stored procedures and functions. +--echo # +create user mysqluser1@localhost; +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; + +--echo # Quick test that granted privileges are properly reflected +--echo # in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con1' as 'mysqluser1@localhost'. +--connect (bug36544_con1,localhost,mysqluser1,,) +call mysqltest1.p1(); +select mysqltest1.f1(); + +--echo # +--echo # Switch to connection 'default'. +--connection default +drop user mysqluser1@localhost; + +--echo # +--echo # Test that dropping of user is properly reflected in +--echo # both privilege tables and in in-memory structures. +--echo # +--echo # Switch to connection 'bug36544_con1'. +--connection bug36544_con1 +--echo # The connection cold be alive but should not be able to +--echo # access to any of the stored routines. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--disconnect bug36544_con1 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now create user with the same name and check that he +--echo # has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con2' as 'mysqluser1@localhost'. +--connect (bug36544_con2,localhost,mysqluser1,,) +--echo # Newly created user should not be able to access any of the routines. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--echo # +--echo # Switch to connection 'default'. +--connection default + +--echo # +--echo # 2) Check that RENAME USER properly updates privileges on both +--echo # stored procedures and functions. +--echo # +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; +--echo # +--echo # Create one more user to make in-memory hashes non-trivial. +--echo # User names 'mysqluser11' and 'mysqluser10' were selected +--echo # to trigger bug discovered during code inspection. +create user mysqluser11@localhost; +grant execute on function mysqltest1.f1 to mysqluser11@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser11@localhost; +--echo # Also create a couple of tables to test for another bug +--echo # discovered during code inspection (again table names were +--echo # chosen especially to trigger the bug). +create table mysqltest1.t11 (i int); +create table mysqltest1.t22 (i int); +grant select on mysqltest1.t22 to mysqluser1@localhost; +grant select on mysqltest1.t11 to mysqluser1@localhost; + +--echo # Quick test that granted privileges are properly reflected +--echo # in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Switch to connection 'bug36544_con2'. +--connection bug36544_con2 +call mysqltest1.p1(); +select mysqltest1.f1(); +select * from mysqltest1.t11; +select * from mysqltest1.t22; + +--echo # +--echo # Switch to connection 'default'. +--connection default +rename user mysqluser1@localhost to mysqluser10@localhost; + +--echo # +--echo # Test that there are no privileges left for mysqluser1. +--echo # +--echo # Switch to connection 'bug36544_con2'. +--connection bug36544_con2 +--echo # The connection cold be alive but should not be able to +--echo # access to any of the stored routines or tables. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t11; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t22; +--disconnect bug36544_con2 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now create user with the old name and check that he +--echo # has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con3' as 'mysqluser1@localhost'. +--connect (bug36544_con3,localhost,mysqluser1,,) +--echo # Newly created user should not be able to access to any of the +--echo # stored routines or tables. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t11; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t22; +--disconnect bug36544_con3 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now check that privileges became associated with a new user +--echo # name - mysqluser10. +--echo # +show grants for mysqluser10@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con4' as 'mysqluser10@localhost'. +--connect (bug36544_con4,localhost,mysqluser10,,) +call mysqltest1.p1(); +select mysqltest1.f1(); +select * from mysqltest1.t11; +select * from mysqltest1.t22; +--disconnect bug36544_con4 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Clean-up. +drop user mysqluser1@localhost; +drop user mysqluser10@localhost; +drop user mysqluser11@localhost; +drop database mysqltest1; + + --echo End of 5.0 tests # diff --git a/mysql-test/t/innodb_mysql_lock.test b/mysql-test/t/innodb_mysql_lock.test index 975444a44b1..f1dc0d52484 100644 --- a/mysql-test/t/innodb_mysql_lock.test +++ b/mysql-test/t/innodb_mysql_lock.test @@ -279,6 +279,38 @@ disconnect con2; disconnect con3; +--echo # +--echo # Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY +--echo # KEY NO 0 FOR TABLE IN ERROR LOG +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +--connect (con1,localhost,root) + +--echo # Connection default +connection default; +CREATE TABLE t1 (id INT PRIMARY KEY, value INT) ENGINE = InnoDB; +INSERT INTO t1 VALUES (1, 12345); +START TRANSACTION; +SELECT * FROM t1; + +--echo # Connection con1 +--connection con1 +SET lock_wait_timeout=1; +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 ADD INDEX idx(value); + +--echo # Connection default +--connection default +SELECT * FROM t1; +COMMIT; +DROP TABLE t1; +disconnect con1; + + # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test index a8925306c70..13c854d6b61 100644 --- a/mysql-test/t/innodb_mysql_sync.test +++ b/mysql-test/t/innodb_mysql_sync.test @@ -152,132 +152,133 @@ disconnect con1; --echo # that implement add_index --echo # ---disable_warnings -DROP DATABASE IF EXISTS db1; -DROP TABLE IF EXISTS t1; ---enable_warnings - -connect(con1,localhost,root); -connect(con2,localhost,root); - ---echo # Test 1: Secondary index, should not block reads (original test case). - ---echo # Connection default -connection default; -CREATE DATABASE db1; -CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb; -INSERT INTO db1.t1(value) VALUES (1), (2); -SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; ---echo # Sending: ---send ALTER TABLE db1.t1 ADD INDEX(value) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; -# Neither of these two statements should be blocked -USE db1; -SELECT * FROM t1; -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value) ---reap -DROP DATABASE db1; - ---echo # Test 2: Primary index (implicit), should block reads. - -CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb; -SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; ---echo # Sending: ---send ALTER TABLE t1 ADD UNIQUE INDEX(a) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; -USE test; ---echo # Sending: ---send SELECT * FROM t1 - ---echo # Connection con2 -connection con2; ---echo # Waiting for SELECT to be blocked by the metadata lock on t1 -let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist - WHERE state= 'Waiting for table metadata lock' - AND info='SELECT * FROM t1'; ---source include/wait_condition.inc -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a) ---reap - ---echo # Connection con1 -connection con1; ---echo # Reaping: SELECT * FROM t1 ---reap - ---echo # Test 3: Primary index (explicit), should block reads. - ---echo # Connection default -connection default; -ALTER TABLE t1 DROP INDEX a; -SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; ---echo # Sending: ---send ALTER TABLE t1 ADD PRIMARY KEY (a) - ---echo # Connection con1 -connection con1; -SET DEBUG_SYNC= "now WAIT_FOR manage"; ---echo # Sending: ---send SELECT * FROM t1 - ---echo # Connection con2 -connection con2; ---echo # Waiting for SELECT to be blocked by the metadata lock on t1 -let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist - WHERE state= 'Waiting for table metadata lock' - AND info='SELECT * FROM t1'; ---source include/wait_condition.inc -SET DEBUG_SYNC= "now SIGNAL query"; - ---echo # Connection default -connection default; ---echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a) ---reap - ---echo # Connection con1 -connection con1; ---echo # Reaping: SELECT * FROM t1 ---reap - ---echo # Test 4: Secondary unique index, should not block reads. -# This requires HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE to be supported -# by InnoDB. Adding this flag currently introduces a regression so -# this test is disabled until the regression has been fixed. +--echo # +--echo # DISABLED due to Bug#11815600 +--echo # ---echo # Connection default -connection default; +#--disable_warnings +#DROP DATABASE IF EXISTS db1; +#DROP TABLE IF EXISTS t1; +#--enable_warnings +# +#connect(con1,localhost,root); +#connect(con2,localhost,root); +# +#--echo # Test 1: Secondary index, should not block reads (original test case). +# +#--echo # Connection default +#connection default; +#CREATE DATABASE db1; +#CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb; +#INSERT INTO db1.t1(value) VALUES (1), (2); +#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +#--echo # Sending: +#--send ALTER TABLE db1.t1 ADD INDEX(value) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +# # Neither of these two statements should be blocked +#USE db1; +#SELECT * FROM t1; +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value) +#--reap +#DROP DATABASE db1; +# +#--echo # Test 2: Primary index (implicit), should block reads. +# +#CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb; +#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +#--echo # Sending: +#--send ALTER TABLE t1 ADD UNIQUE INDEX(a) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +#USE test; +#--echo # Sending: +#--send SELECT * FROM t1 +# +#--echo # Connection con2 +#connection con2; +#--echo # Waiting for SELECT to be blocked by the metadata lock on t1 +#let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist +# WHERE state= 'Waiting for table metadata lock' +# AND info='SELECT * FROM t1'; +#--source include/wait_condition.inc +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a) +#--reap +# +#--echo # Connection con1 +#connection con1; +#--echo # Reaping: SELECT * FROM t1 +#--reap +# +#--echo # Test 3: Primary index (explicit), should block reads. +# +#--echo # Connection default +#connection default; +#ALTER TABLE t1 DROP INDEX a; +#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +#--echo # Sending: +#--send ALTER TABLE t1 ADD PRIMARY KEY (a) +# +#--echo # Connection con1 +#connection con1; +#SET DEBUG_SYNC= "now WAIT_FOR manage"; +#--echo # Sending: +#--send SELECT * FROM t1 +# +#--echo # Connection con2 +#connection con2; +#--echo # Waiting for SELECT to be blocked by the metadata lock on t1 +#let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist +# WHERE state= 'Waiting for table metadata lock' +# AND info='SELECT * FROM t1'; +#--source include/wait_condition.inc +#SET DEBUG_SYNC= "now SIGNAL query"; +# +#--echo # Connection default +#connection default; +#--echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a) +#--reap +# +#--echo # Connection con1 +#connection con1; +#--echo # Reaping: SELECT * FROM t1 +#--reap +# +#--echo # Test 4: Secondary unique index, should not block reads. +# +#--echo # Connection default +#connection default; #SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; #--echo # Sending: #--send ALTER TABLE t1 ADD UNIQUE (b) - +# #--echo # Connection con1 #connection con1; #SET DEBUG_SYNC= "now WAIT_FOR manage"; #SELECT * FROM t1; #SET DEBUG_SYNC= "now SIGNAL query"; - +# #--echo # Connection default #connection default; #--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b) #--reap - -disconnect con1; -disconnect con2; -SET DEBUG_SYNC= "RESET"; -DROP TABLE t1; +# +#disconnect con1; +#disconnect con2; +#SET DEBUG_SYNC= "RESET"; +#DROP TABLE t1; # Check that all connections opened by test cases in this file are really diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 06054d1990d..8e5cba01d28 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -601,5 +601,18 @@ DROP TABLE t1; let $MYSQLD_DATADIR= `select @@datadir`; remove_file $MYSQLD_DATADIR/test/tmpp2.txt; +--echo # +--echo # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U +--echo # + +CREATE TABLE t1(f1 INT); +EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; +--disable_warnings +LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; +--enable_warnings + +DROP TABLE t1; +let $MYSQLD_DATADIR= `select @@datadir`; +remove_file $MYSQLD_DATADIR/test/t1.dat; --echo End of 5.1 tests diff --git a/mysql-test/t/lowercase_table2.test b/mysql-test/t/lowercase_table2.test index d8aa4e97fb3..30433d15be4 100644 --- a/mysql-test/t/lowercase_table2.test +++ b/mysql-test/t/lowercase_table2.test @@ -151,6 +151,41 @@ where TABLE_SCHEMA ='mysqltest_LC2'; use test; drop database mysqltest_LC2; + +--echo # +--echo # Bug #11758687: 50924: object names not resolved correctly +--echo # on lctn2 systems +--echo # + +CREATE DATABASE BUP_XPFM_COMPAT_DB2; + +CREATE TABLE BUP_XPFM_COMPAT_DB2.TABLE2 (c13 INT) DEFAULT CHARSET latin1; +CREATE TABLE BUP_XPFM_COMPAT_DB2.table1 (c13 INT) DEFAULT CHARSET latin1; +CREATE TABLE bup_xpfm_compat_db2.table3 (c13 INT) DEFAULT CHARSET latin1; + +delimiter |; +# +CREATE TRIGGER BUP_XPFM_COMPAT_DB2.trigger1 AFTER INSERT + ON BUP_XPFM_COMPAT_DB2.table1 FOR EACH ROW + update BUP_XPFM_COMPAT_DB2.table1 set c13=12; +| +CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TRIGGER2 AFTER INSERT + ON BUP_XPFM_COMPAT_DB2.TABLE2 FOR EACH ROW + update BUP_XPFM_COMPAT_DB2.table1 set c13=12; +| +CREATE TRIGGER BUP_XPFM_COMPAT_DB2.TrigGer3 AFTER INSERT + ON BUP_XPFM_COMPAT_DB2.TaBle3 FOR EACH ROW + update BUP_XPFM_COMPAT_DB2.table1 set c13=12; +| +delimiter ;| + +SELECT trigger_schema, trigger_name, event_object_table FROM +INFORMATION_SCHEMA.TRIGGERS + WHERE trigger_schema COLLATE utf8_bin = 'BUP_XPFM_COMPAT_DB2' + ORDER BY trigger_schema, trigger_name; + +DROP DATABASE BUP_XPFM_COMPAT_DB2; + --echo # End of 5.1 tests diff --git a/mysql-test/t/myisam_crash_before_flush_keys.test b/mysql-test/t/myisam_crash_before_flush_keys.test index 0b0491098cd..a9f36f40d10 100644 --- a/mysql-test/t/myisam_crash_before_flush_keys.test +++ b/mysql-test/t/myisam_crash_before_flush_keys.test @@ -10,6 +10,8 @@ call mtr.add_suppression("Got an error from thread_id=.*ha_myisam.cc:"); call mtr.add_suppression("MySQL thread id .*, query id .* localhost.*root Checking table"); +# Avoid CrashReporter popup on Mac +--source include/not_crashrep.inc let $MYSQLD_DATADIR= `select @@datadir`; SET GLOBAL delay_key_write=ALL; diff --git a/mysql-test/t/mysql_client_test-master.opt b/mysql-test/t/mysql_client_test-master.opt index 4c683f7f0a2..3dfaf15666f 100644 --- a/mysql-test/t/mysql_client_test-master.opt +++ b/mysql-test/t/mysql_client_test-master.opt @@ -1 +1,4 @@ ---log=$MYSQLTEST_VARDIR/log/master.log --log-output=FILE,TABLE +--log=$MYSQLTEST_VARDIR/log/master.log +--log-output=FILE,TABLE +$PLUGIN_AUTH_OPT +$PLUGIN_AUTH_LOAD diff --git a/mysql-test/t/mysql_client_test.test b/mysql-test/t/mysql_client_test.test index 2c19671d11b..529d60517c0 100644 --- a/mysql-test/t/mysql_client_test.test +++ b/mysql-test/t/mysql_client_test.test @@ -1,5 +1,7 @@ # This test should work in embedded server after we fix mysqltest -- source include/not_embedded.inc +# need to have the dynamic loading turned on for the client plugin tests +--source include/have_plugin_auth.inc SET @old_general_log= @@global.general_log; SET @old_slow_query_log= @@global.slow_query_log; @@ -12,7 +14,7 @@ SET @old_slow_query_log= @@global.slow_query_log; # var/log/mysql_client_test.trace --exec echo "$MYSQL_CLIENT_TEST" > $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 ---exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 +--exec $MYSQL_CLIENT_TEST --getopt-ll-test=25600M $PLUGIN_AUTH_CLIENT_OPT >> $MYSQLTEST_VARDIR/log/mysql_client_test.out.log 2>&1 # End of 4.1 tests echo ok; diff --git a/mysql-test/t/mysqladmin.test b/mysql-test/t/mysqladmin.test index c3bfc585289..4811c5fdbc6 100644 --- a/mysql-test/t/mysqladmin.test +++ b/mysql-test/t/mysqladmin.test @@ -45,3 +45,17 @@ remove_file $MYSQLTEST_VARDIR/tmp/bug10608.cnf; --cat_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp --remove_file $MYSQLTEST_VARDIR/tmp/mysqladmin.tmp + +--echo # +--echo # BUG#11766184 - 59234: cmdline clients crash --defaults-extra-file +--echo # with no .cnf or .ini extension. +--echo # + +--echo # Creating an empty file 'cnf_file' +--write_file $MYSQLTEST_VARDIR/tmp/cnf_file +EOF + +--echo # Using --defaults-extra-file option with 'cnf_file'. +--exec $MYSQLADMIN --defaults-extra-file=$MYSQLTEST_VARDIR/tmp/cnf_file -uroot -S $MASTER_MYSOCK -P $MASTER_MYPORT ping 2>&1 + +--remove_file $MYSQLTEST_VARDIR/tmp/cnf_file diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test index 714cfbbaa9b..f64d8b502ae 100644 --- a/mysql-test/t/mysqlbinlog.test +++ b/mysql-test/t/mysqlbinlog.test @@ -527,3 +527,23 @@ 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; +# +# BUG#11766427 BUG#59530: Filter by server id in mysqlbinlog fails +# This test checks that the format description log event is not +# filtered out by the --server-id option. +# +RESET MASTER; +USE test; +CREATE TABLE t1 (a INT); +--let $old_server_id= `SELECT @@GLOBAL.SERVER_ID` +SET GLOBAL SERVER_ID = 2; +DROP TABLE t1; +--let $master_binlog= query_get_value(SHOW MASTER STATUS, File, 1) +FLUSH LOGS; +# The following should only create t1, not drop it. +--exec $MYSQL_BINLOG --server-id=1 $MYSQLD_DATADIR/$master_binlog | $MYSQL +SHOW TABLES IN test; +# The following should only drop t1, not create it. +--exec $MYSQL_BINLOG --server-id=2 $MYSQLD_DATADIR/$master_binlog | $MYSQL +SHOW TABLES IN test; +eval SET GLOBAL SERVER_ID = $old_server_id; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index dd113cb4e74..8f93ac7b864 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -2,6 +2,8 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/have_innodb.inc + # check that CSV engine was compiled in, as the result of the test # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc @@ -34,7 +36,7 @@ drop database if exists client_test_db; # # Bug #16502: mysqlcheck tries to check views # -create table t1 (a int); +create table t1 (a int) engine=myisam; create view v1 as select * from t1; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --analyze --databases test @@ -48,8 +50,8 @@ drop table t1; # # Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks # -create table `t``1`(a int); -create table `t 1`(a int); +create table `t``1`(a int) engine=myisam; +create table `t 1`(a int) engine=myisam; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --databases test drop table `t``1`, `t 1`; @@ -59,7 +61,7 @@ drop table `t``1`, `t 1`; # create database d_bug25347; use d_bug25347; -create table t_bug25347 (a int); +create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; @@ -91,8 +93,8 @@ drop view v1; # Bug#37527: mysqlcheck fails to report entire database # when frm file corruption # -CREATE TABLE t1(a INT); -CREATE TABLE t2(a INT); +CREATE TABLE t1(a INT) engine=myisam; +CREATE TABLE t2(a INT) engine=myisam; # backup then null t1.frm --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak --remove_file $MYSQLD_DATADIR/test/t1.frm @@ -112,7 +114,7 @@ DROP TABLE t1, t2; # # Bug #30679: 5.1 name encoding not performed for views during upgrade # -create table t1(a int); +create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; let $MYSQLD_DATADIR= `select @@datadir`; @@ -131,7 +133,7 @@ drop table t1; # triggers # SET NAMES utf8; -CREATE TABLE `#mysql50#@` (a INT); +CREATE TABLE `#mysql50#@` (a INT) engine=myisam; SHOW TABLES; SET NAMES DEFAULT; --echo mysqlcheck --fix-table-names --databases test @@ -140,7 +142,7 @@ SET NAMES utf8; SHOW TABLES; DROP TABLE `@`; -CREATE TABLE `Ñ` (a INT); +CREATE TABLE `Ñ` (a INT) engine=myisam; SET NAMES DEFAULT; --echo mysqlcheck --default-character-set="latin1" --databases test # Error returned depends on platform, replace it with "Table doesn't exist" @@ -154,8 +156,8 @@ SET NAMES DEFAULT; CREATE DATABASE `#mysql50#a@b`; USE `#mysql50#a@b`; -CREATE TABLE `#mysql50#c@d` (a INT); -CREATE TABLE t1 (a INT); +CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; +CREATE TABLE t1 (a INT) engine=myisam; # Create 5.0 like triggers let $MYSQLTEST_VARDIR= `select @@datadir`; @@ -207,12 +209,12 @@ USE test; drop table if exists `#mysql50#t1-1`; --enable_warnings -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test show tables like 't1-1'; drop table `t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1" show tables like 't1-1'; drop table `t1-1`; @@ -229,3 +231,83 @@ drop table `t1-1`; --error 1 --exec $MYSQL_CHECK -aoc test "#mysql50#t1-1" + +--echo # +--echo # Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR +--echo # ENGINES NOT SUPPORTING NATIVE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS bug47205; +--enable_warnings + +--echo # +--echo # Test 1: Check that ALTER TABLE ... rebuilds the table + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +INSERT INTO bug47205 VALUES ("foobar"); +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE ... FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # ALTER TABLE ... FORCE should rebuild the table +--echo # and therefore output "affected rows: 1" +--enable_info +ALTER TABLE bug47205 FORCE; +--disable_info + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 2: InnoDB - REPAIR not supported + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE .. FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 3: MyISAM - REPAIR supported + +--echo # Use an old FRM that will require upgrade +--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/bug47205.MYD +--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/bug47205.MYI + +--echo # Should indicate that REPAIR TABLE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 44245eb9d44..09648faca94 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2198,10 +2198,22 @@ ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; --exec $MYSQL_DUMP --quote-names --compact test-database DROP DATABASE `test-database`; +# Switching back to test database. +USE `test`; --echo # --echo # End of 5.1 tests --echo # +--echo # +--echo # Verify that two modes can be given in --compatible; +--echo # and are reflected in SET SQL_MODE in the mysqldump output. +--echo # Also verify that a prefix of the mode's name is enough. +--echo # +CREATE TABLE t1 (a INT); +# no_t = no_table_options; no_f = no_field_options +--exec $MYSQL_DUMP --compatible=no_t,no_f --skip-comments test +DROP TABLE t1; + # Wait till we reached the initial number of concurrent sessions --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/mysqlslap.test b/mysql-test/t/mysqlslap.test index 28042f62fe6..757d2813483 100644 --- a/mysql-test/t/mysqlslap.test +++ b/mysql-test/t/mysqlslap.test @@ -53,3 +53,18 @@ CREATE PROCEDURE p1() SELECT 1; --exec $MYSQL_SLAP --create-schema=test --delimiter=";" --query="CALL p1; SELECT 1;" --silent 2>&1 DROP PROCEDURE p1; + + +--echo # +--echo # Bug #11765157 - 58090: mysqlslap drops schema specified in +--echo # create_schema if auto-generate-sql also set. +--echo # + +--exec $MYSQL_SLAP --silent --create-schema=bug58090 --concurrency=5 --iterations=20 --auto-generate-sql +--echo # 'bug58090' database should not be present. +SHOW DATABASES; +--exec $MYSQL_SLAP --silent --create-schema=bug58090 --no-drop --auto-generate-sql +--echo # 'bug58090' database should be present. +SHOW DATABASES; +DROP DATABASE bug58090; + diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 5998d6269fb..726dfa154b8 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -847,8 +847,7 @@ CALL mtr.add_suppression("Out of sort memory"); --error ER_OUT_OF_SORTMEMORY select * from t1 order by b; drop table t1; - - +call mtr.add_suppression("Out of sort memory; increase server sort buffer size"); --echo # --echo # Bug #39844: Query Crash Mysql Server 5.0.67 --echo # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index f2e8cbb2da2..7fb5f434b83 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -15,6 +15,49 @@ drop table if exists t1, t2; --enable_warnings --echo # +--echo # Bug#59297: Can't find record in 'tablename' on update inner join +--echo # + +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; + +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; + +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; + +DROP TABLE t1; + +--echo # --echo # Bug#57778: failed primary key add to partitioned innodb table --echo # inconsistent and crashes --echo # diff --git a/mysql-test/t/partition_error.test b/mysql-test/t/partition_error.test index 61b14b81fca..536935420a4 100644 --- a/mysql-test/t/partition_error.test +++ b/mysql-test/t/partition_error.test @@ -741,65 +741,9 @@ DROP TABLE t1; CREATE TABLE t1 (c TIMESTAMP) PARTITION BY HASH (c) PARTITIONS 4; +--echo # Moved to partition_myisam, since it was MyISAM specific --echo # Added test with existing TIMESTAMP partitioning (when it was allowed). -CREATE TABLE t1 (a TIMESTAMP) -PARTITION BY HASH (UNIX_TIMESTAMP(a)); -INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); ---sorted_result -SELECT * FROM t1; -FLUSH TABLES; ---echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier. ---remove_file $MYSQLD_DATADIR/test/t1.frm ---copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm ---echo # Disable warnings, since the result would differ when running with ---echo # --ps-protocol (only for the 'SELECT * FROM t1' statement). ---disable_warnings ---sorted_result -SELECT * FROM t1; ---enable_warnings -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); ---sorted_result -SELECT * FROM t1; -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; ---error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR -ALTER TABLE t1 -PARTITION BY RANGE (TO_DAYS(a)) -(PARTITION p0 VALUES LESS THAN (10000), - PARTITION p1 VALUES LESS THAN (MAXVALUE)); -SHOW CREATE TABLE t1; -CREATE TABLE t2 LIKE t1; -SHOW CREATE TABLE t2; -DROP TABLE t2; -CREATE TABLE t2 SELECT * FROM t1; -DROP TABLE t2; -ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); -SHOW CREATE TABLE t1; -ALTER TABLE t1 ADD PARTITION PARTITIONS 2; -SHOW CREATE TABLE t1; ---sorted_result -SELECT * FROM t1; -DROP TABLE t1; - ---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); -FLUSH TABLES; ---remove_file $MYSQLD_DATADIR/test/t1.par ---replace_result $MYSQLD_DATADIR ./ -CHECK TABLE t1; ---error ER_FAILED_READ_FROM_PAR_FILE -SELECT * FROM t1; ---echo # Note that it is currently impossible to drop a partitioned table ---echo # without the .par file ---error ER_BAD_TABLE_ERROR -DROP TABLE t1; ---remove_file $MYSQLD_DATADIR/test/t1.frm ---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI ---remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD - --echo # --echo # Bug#49477: Assertion `0' failed in ha_partition.cc:5530 --echo # with temporary table and partitions @@ -820,6 +764,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing'); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) @@ -830,6 +775,7 @@ SUBPARTITION BY HASH(TO_DAYS(purchased)) SUBPARTITIONS 2 DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing', SUBPARTITION sp1)); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; CREATE TABLE t1 (id INT, purchased DATE) @@ -837,34 +783,11 @@ PARTITION BY RANGE(YEAR(purchased)) (PARTITION p0 VALUES LESS THAN MAXVALUE DATA DIRECTORY = '/tmp/not-existing' INDEX DIRECTORY = '/tmp/not-existing'); +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> SHOW CREATE TABLE t1; DROP TABLE t1; SET @@sql_mode= @org_mode; ---echo # ---echo # Bug#50392: insert_id is not reset for partitioned tables ---echo # auto_increment on duplicate entry -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; ---error ER_DUP_ENTRY -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t1; -CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) PARTITION BY KEY(a); -SET INSERT_ID= 13; -INSERT INTO t1 VALUES (NULL); -SET INSERT_ID= 12; ---error ER_DUP_ENTRY -INSERT INTO t1 VALUES (NULL), (NULL), (NULL); -SHOW CREATE TABLE t1; -INSERT INTO t1 VALUES (NULL); -SELECT * FROM t1; -DROP TABLE t1; - # # Bug#38719: Partitioning returns a different error code for a # duplicate key error @@ -879,24 +802,6 @@ INSERT INTO t1 VALUES (1),(1); DROP TABLE t1; # -# Bug#31931: Mix of handlers error message -# ---error ER_MIX_HANDLER_ERROR -CREATE TABLE t1 (a INT) -PARTITION BY HASH (a) -( PARTITION p0 ENGINE=MyISAM, - PARTITION p1); ---error ER_MIX_HANDLER_ERROR -CREATE TABLE t1 (a INT) -PARTITION BY LIST (a) -SUBPARTITION BY HASH (a) -( PARTITION p0 VALUES IN (0) -( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), - PARTITION p1 VALUES IN (1) -( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); - - -# # Bug 29368: # Incorrect error, 1467, for syntax error when creating partition --error ER_PARTITION_REQUIRES_VALUES_ERROR @@ -912,7 +817,7 @@ PARTITION BY RANGE (a) # # Partition by key stand-alone error # ---error 1064 +--error ER_PARSE_ERROR partition by list (a) partitions 3 (partition x1 values in (1,2,9,4) tablespace ts1, @@ -949,7 +854,7 @@ partitions 3 # # Partition by key, partition function not allowed # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -964,7 +869,7 @@ partitions 3 # # Partition by key, no partition name # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -995,7 +900,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by hash, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1025,7 +930,7 @@ partitions 3 # # Partition by key specified 3 partitions but only defined 2 => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1038,7 +943,7 @@ partitions 3 # # Partition by hash, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1051,7 +956,7 @@ partitions 2 # # Partition by range, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1064,7 +969,7 @@ partitions 2 # # Partition by list, random function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1200,7 +1105,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1227,7 +1132,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1268,7 +1173,7 @@ subpartition by hash (3+4); # # Subpartition by hash, no partitions defined, wrong subpartition function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1294,7 +1199,7 @@ select load_file('$MYSQLD_DATADIR/test/t1.par'); # # Partition by range, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1448,7 +1353,7 @@ partitions 2 # # Subpartition by hash, wrong number of subpartitions # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1468,7 +1373,7 @@ subpartitions 3 # # Subpartition by hash, wrong number of subpartitions # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1488,7 +1393,7 @@ subpartition by hash (a+b) # # Subpartition by list => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1507,7 +1412,7 @@ subpartition by list (a+b) # # Subpartition by list => error # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1551,7 +1456,7 @@ partitions 2 # # Partition by list, invalid field in function # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1635,7 +1540,7 @@ partitions 2 # # Partition by list, missing parenthesis # ---error 1064 +--error ER_PARSE_ERROR CREATE TABLE t1 ( a int not null, b int not null, @@ -1649,7 +1554,7 @@ partitions 2 # # Bug #13439: Crash when LESS THAN (non-literal) # ---error 1054 +--error ER_BAD_FIELD_ERROR CREATE TABLE t1 (a int) PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (x1)); @@ -1676,13 +1581,13 @@ partition by range (ascii(v)) (partition p0 values less than (10)); #drop table t1; --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash (rand(a)); --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash(CURTIME() + a); --- error 1064 +-- error ER_PARSE_ERROR create table t1 (a int) partition by hash (NOW()+a); -- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED diff --git a/mysql-test/t/partition_myisam.test b/mysql-test/t/partition_myisam.test new file mode 100644 index 00000000000..37d4a071fb9 --- /dev/null +++ b/mysql-test/t/partition_myisam.test @@ -0,0 +1,173 @@ +-- source include/have_partition.inc + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +# These tests is only useful when running on MyISAM, +# due to DATA/INDEX directory, non transactional behavior, tests with MyISAM +# files etc. + +let $MYSQLD_DATADIR= `SELECT @@datadir`; + + +--echo # +--echo # Bug#50036: Inconsistent errors when using TIMESTAMP +--echo # columns/expressions + +--echo # Added test with existing TIMESTAMP partitioning (when it was allowed). +CREATE TABLE t1 (a TIMESTAMP) +ENGINE = MyISAM +PARTITION BY HASH (UNIX_TIMESTAMP(a)); +INSERT INTO t1 VALUES ('2000-01-02 03:04:05'); +--sorted_result +SELECT * FROM t1; +FLUSH TABLES; +--echo # replacing t1.frm with TO_DAYS(a) which was allowed earlier. +--remove_file $MYSQLD_DATADIR/test/t1.frm +--copy_file std_data/parts/t1TIMESTAMP.frm $MYSQLD_DATADIR/test/t1.frm +--echo # Disable warnings, since the result would differ when running with +--echo # --ps-protocol (only for the 'SELECT * FROM t1' statement). +--disable_warnings +--sorted_result +SELECT * FROM t1; +--enable_warnings +--replace_result MyISAM <curr_engine> InnoDB <curr_engine> +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES ('2001-02-03 04:05:06'); +--sorted_result +SELECT * FROM t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 +PARTITION BY RANGE (TO_DAYS(a)) +(PARTITION p0 VALUES LESS THAN (10000), + PARTITION p1 VALUES LESS THAN (MAXVALUE)); +SHOW CREATE TABLE t1; +CREATE TABLE t2 LIKE t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +CREATE TABLE t2 SELECT * FROM t1; +DROP TABLE t2; +ALTER TABLE t1 PARTITION BY HASH (UNIX_TIMESTAMP(a)); +SHOW CREATE TABLE t1; +ALTER TABLE t1 ADD PARTITION PARTITIONS 2; +SHOW CREATE TABLE t1; +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Bug#31931: Mix of handlers error message +--echo # +--error ER_MIX_HANDLER_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY HASH (a) +( PARTITION p0 ENGINE=MyISAM, + PARTITION p1); +--error ER_MIX_HANDLER_ERROR +CREATE TABLE t1 (a INT) +PARTITION BY LIST (a) +SUBPARTITION BY HASH (a) +( PARTITION p0 VALUES IN (0) +( SUBPARTITION s0, SUBPARTITION s1 ENGINE=MyISAM, SUBPARTITION s2), + PARTITION p1 VALUES IN (1) +( SUBPARTITION s3 ENGINE=MyISAM, SUBPARTITION s4, SUBPARTITION s5 ENGINE=MyISAM)); + +--echo # +--echo # Bug#49161: Out of memory; restart server and try again (needed 2 bytes) +--echo # +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY HASH (a); +FLUSH TABLES; +--remove_file $MYSQLD_DATADIR/test/t1.par +--replace_result $MYSQLD_DATADIR ./ +CHECK TABLE t1; +--error ER_FAILED_READ_FROM_PAR_FILE +SELECT * FROM t1; +--echo # Note that it is currently impossible to drop a partitioned table +--echo # without the .par file +--error ER_BAD_TABLE_ERROR +DROP TABLE t1; +--remove_file $MYSQLD_DATADIR/test/t1.frm +--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYI +--remove_file $MYSQLD_DATADIR/test/t1#P#p0.MYD + +--echo # +--echo # Bug#50392: insert_id is not reset for partitioned tables +--echo # auto_increment on duplicate entry +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM; +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--echo # For transactional engines, 12 will not be inserted, since the failing +--echo # statement is rolled back. +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +--echo # NOTE: 12 exists only in non transactional engines! +SELECT * FROM t1; +DROP TABLE t1; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) +ENGINE = MyISAM +PARTITION BY KEY(a); +SET INSERT_ID= 13; +INSERT INTO t1 VALUES (NULL); +SET INSERT_ID= 12; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES (NULL), (NULL), (NULL); +SHOW CREATE TABLE t1; +INSERT INTO t1 VALUES (NULL); +SELECT * FROM t1; +DROP TABLE t1; +# +# Bug#30102: rename table does corrupt tables with partition files on failure +# +--echo # Bug#30102 test +CREATE TABLE t1 (a INT) +ENGINE = MyISAM +PARTITION BY RANGE (a) +(PARTITION p0 VALUES LESS THAN (6), + PARTITION `p1....................` VALUES LESS THAN (9), + PARTITION p2 VALUES LESS THAN MAXVALUE); +# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending +# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars +--echo # List of files in database `test`, all original t1-files here +--list_files $MYSQLD_DATADIR/test t1* +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +--echo # Renaming to a file name where the first partition is 250 chars +--echo # and the second partition is 350 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_new..............................................end`; +# 1234567890123456789012345678901234567890123456 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--echo # Renaming to a file name where the first partition is 156 chars +--echo # and the second partition is 256 chars +# 7,7 avoids the error message, which is not deterministic. +--error 7,7 +RENAME TABLE t1 TO `t2_............................_end`; +# 1234567890123456789012345678 +# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156 +--echo # List of files in database `test`, should not be any t2-files here +--list_files $MYSQLD_DATADIR/test t2* +--echo # List of files in database `test`, should be all t1-files here +--list_files $MYSQLD_DATADIR/test t1* +--sorted_result +SELECT * FROM t1; +DROP TABLE t1; +--echo # Should not be any files left here +--list_files $MYSQLD_DATADIR/test t1* +--list_files $MYSQLD_DATADIR/test t2* +--echo # End of bug#30102 test. diff --git a/mysql-test/t/partition_not_embedded.test b/mysql-test/t/partition_not_embedded.test deleted file mode 100644 index 5c512085a9e..00000000000 --- a/mysql-test/t/partition_not_embedded.test +++ /dev/null @@ -1,53 +0,0 @@ --- source include/have_partition.inc --- source include/not_embedded.inc ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings -let $MYSQLD_DATADIR= `SELECT @@datadir`; - -# -# Bug#30102: rename table does corrupt tables with partition files on failure -# ---echo # Bug#30102 test -CREATE TABLE t1 (a INT) -PARTITION BY RANGE (a) -(PARTITION p0 VALUES LESS THAN (6), - PARTITION `p1....................` VALUES LESS THAN (9), - PARTITION p2 VALUES LESS THAN MAXVALUE); -# partition p1 is 't1#P#p1' + @002e * 20 = 107 characters + file ending -# total path lenght of './test/t1#P#p1@002e@002e<...>@002e.MY[ID]' is 118 chars ---echo # List of files in database `test`, all original t1-files here ---list_files $MYSQLD_DATADIR/test t1* -INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); ---echo # Renaming to a file name where the first partition is 250 chars ---echo # and the second partition is 350 chars -# 7,7 avoids the error message, which is not deterministic. ---error 7,7 -RENAME TABLE t1 TO `t2_new..............................................end`; -# 1234567890123456789012345678901234567890123456 ---echo # List of files in database `test`, should not be any t2-files here ---list_files $MYSQLD_DATADIR/test t2* ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---sorted_result -SELECT * FROM t1; ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---echo # Renaming to a file name where the first partition is 156 chars ---echo # and the second partition is 256 chars -# 7,7 avoids the error message, which is not deterministic. ---error 7,7 -RENAME TABLE t1 TO `t2_............................_end`; -# 1234567890123456789012345678 -# 7 + 4 + 5 + 28 * 5 = 16 + 140 = 156 ---echo # List of files in database `test`, should not be any t2-files here ---list_files $MYSQLD_DATADIR/test t2* ---echo # List of files in database `test`, should be all t1-files here ---list_files $MYSQLD_DATADIR/test t1* ---sorted_result -SELECT * FROM t1; -DROP TABLE t1; ---echo # Should not be any files left here ---list_files $MYSQLD_DATADIR/test t1* ---list_files $MYSQLD_DATADIR/test t2* ---echo # End of bug#30102 test. diff --git a/mysql-test/t/partition_symlink.test b/mysql-test/t/partition_symlink.test index 4147d2c6e89..5fdde8e0abc 100644 --- a/mysql-test/t/partition_symlink.test +++ b/mysql-test/t/partition_symlink.test @@ -1,5 +1,6 @@ # Test that must have symlink. eg. using DATA/INDEX DIR # (DATA/INDEX DIR requires symlinks) +# This test is only useful for MyISAM, since no other engine supports DATA DIR -- source include/have_partition.inc -- source include/have_symlink.inc # remove the not_windows line after fixing bug#33687 @@ -33,13 +34,14 @@ DROP DATABASE IF EXISTS mysqltest2; CREATE USER mysqltest_1@localhost; CREATE DATABASE mysqltest2; USE mysqltest2; - CREATE TABLE t1 (a INT); + CREATE TABLE t1 (a INT) ENGINE = MyISAM; INSERT INTO t1 VALUES (0); connect(con1,localhost,mysqltest_1,,); -- echo # user mysqltest_1: USE test; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -82,6 +84,7 @@ connection default; USE mysqltest2; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -96,6 +99,7 @@ connection con1; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- error 1,1 eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -107,6 +111,7 @@ connection con1; -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR -- error 1,1 eval CREATE TABLE t1 (a INT) + ENGINE = MyISAM PARTITION BY LIST (a) ( PARTITION p0 VALUES IN (0) DATA DIRECTORY '$MYSQLTEST_VARDIR/tmp' @@ -128,6 +133,7 @@ connection default; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR eval create table t2 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -139,6 +145,7 @@ set @org_mode=@@sql_mode; set @@sql_mode='NO_DIR_IN_CREATE'; select @@sql_mode; create table t1 (i int ) +ENGINE = MyISAM partition by range (i) ( partition p01 values less than (1000) @@ -157,6 +164,7 @@ set @@sql_mode=@org_mode; # Added ER_WRONG_TABLE_NAME and reported bug#39045 -- error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); @@ -167,6 +175,7 @@ partition by key (a) # Added ER_WRONG_TABLE_NAME and reported bug#39045 --error ER_WRONG_ARGUMENTS, ER_WRONG_TABLE_NAME create table t1 (a int) +ENGINE = MyISAM partition by key (a) (partition p0, partition p1 DATA DIRECTORY 'part-data' INDEX DIRECTORY 'part-data'); diff --git a/mysql-test/t/plugin_auth.test b/mysql-test/t/plugin_auth.test index 753593efc94..a81cf4e4783 100644 --- a/mysql-test/t/plugin_auth.test +++ b/mysql-test/t/plugin_auth.test @@ -433,4 +433,83 @@ connection default; disconnect cleartext_con; DROP USER uplain@localhost; +--echo # +--echo # Bug #59038 : mysql.user.authentication_string column +--echo # causes configuration wizard to fail + +INSERT INTO mysql.user( + Host, + User, + Password, + Select_priv, + Insert_priv, + Update_priv, + Delete_priv, + Create_priv, + Drop_priv, + Reload_priv, + Shutdown_priv, + Process_priv, + File_priv, + Grant_priv, + References_priv, + Index_priv, + Alter_priv, + Show_db_priv, + Super_priv, + Create_tmp_table_priv, + Lock_tables_priv, + Execute_priv, + Repl_slave_priv, + Repl_client_priv, + /*!50001 + Create_view_priv, + Show_view_priv, + Create_routine_priv, + Alter_routine_priv, + Create_user_priv, + */ + ssl_type, + ssl_cipher, + x509_issuer, + x509_subject, + max_questions, + max_updates, + max_connections) +VALUES ( + 'localhost', + 'inserttest', '', + 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', + 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', + /*!50001 'Y', 'Y', 'Y', 'Y', 'Y', */'', '', '', '', '0', '0', '0'); +FLUSH PRIVILEGES; +DROP USER inserttest@localhost; +SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE + COLUMN_NAME IN ('authentication_string', 'plugin') AND + TABLE_NAME='user' AND + TABLE_SCHEMA='mysql' +ORDER BY COLUMN_NAME; + + +--echo # +--echo # Bug #11936829: diff. between mysql.user (authentication_string) +--echo # in fresh and upgraded 5.5.11 +--echo # + +SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND + COLUMN_NAME IN ('plugin', 'authentication_string') + ORDER BY COLUMN_NAME; +ALTER TABLE mysql.user MODIFY plugin char(64) DEFAULT '' NOT NULL; +ALTER TABLE mysql.user MODIFY authentication_string TEXT NOT NULL; + +--echo Run mysql_upgrade on a 5.5.10 external authentication column layout +--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1 + +SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA= 'mysql' AND TABLE_NAME= 'user' AND + COLUMN_NAME IN ('plugin', 'authentication_string') + ORDER BY COLUMN_NAME; + + --echo End of 5.5 tests diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index eaef1cf3000..e00bd785789 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -3344,7 +3344,21 @@ connection default; DROP TABLE t1; disconnect con1; +--echo +--echo # +--echo # Bug#56115: invalid memory reads when PS selecting from +--echo # information_schema tables +--echo # Bug#58701: crash in Field::make_field, cursor-protocol +--echo # +--echo # NOTE: MTR should be run both with --ps-protocol and --cursor-protocol. +--echo # +--echo + +SELECT * +FROM (SELECT 1 UNION SELECT 2) t; + + --echo # ---echo # End of 6.0 tests. +--echo # End of 5.5 tests. ########################################################################### diff --git a/mysql-test/t/show_check.test b/mysql-test/t/show_check.test index a334a5f7791..bc5ac8ac63f 100644 --- a/mysql-test/t/show_check.test +++ b/mysql-test/t/show_check.test @@ -1082,6 +1082,7 @@ DROP DATABASE `ä`; # --error ER_NO_SUCH_TABLE,ER_FILE_NOT_FOUND show columns from `#mysql50#????????`; +call mtr.add_suppression("Can.t find file: '.\\\\test\\\\\\?{8}.frm'"); # # SHOW CREATE TRIGGER test. diff --git a/mysql-test/t/sp-destruct.test b/mysql-test/t/sp-destruct.test index b4aa9ea1959..6766b496db7 100644 --- a/mysql-test/t/sp-destruct.test +++ b/mysql-test/t/sp-destruct.test @@ -14,6 +14,7 @@ # Supress warnings written to the log file call mtr.add_suppression("Column count of mysql.proc is wrong. Expected 20, found 19. The table is probably corrupted"); +call mtr.add_suppression("Stored routine .test...bug14233_[123].: invalid value in column mysql.proc"); # Backup proc table let $MYSQLD_DATADIR= `select @@datadir`; diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index 11edeaf9811..1ed11c50ba8 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -8713,4 +8713,45 @@ call p1(3, 2); drop table t1; drop procedure p1; +--echo +--echo # -- +--echo # -- Bug 11765684 - 58674: SP-cache does not detect changes in +--echo # -- pre-locking list caused by triggers +--echo # --- + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; +DROP PROCEDURE IF EXISTS p1; +--enable_warnings + +CREATE TABLE t1(a INT); +CREATE TABLE t2(a INT); +CREATE TABLE t3(a INT); + +CREATE PROCEDURE p1() + INSERT INTO t1(a) VALUES (1); + +--echo +CREATE TRIGGER t1_ai AFTER INSERT ON t1 + FOR EACH ROW + INSERT INTO t2(a) VALUES (new.a); + +--echo +CALL p1(); + +--echo +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 + FOR EACH ROW + INSERT INTO t3(a) VALUES (new.a); + +--echo +CALL p1(); + +--echo +DROP TABLE t1, t2, t3; +DROP PROCEDURE p1; +--echo + --echo # End of 5.5 test diff --git a/mysql-test/t/ssl_cipher-master.opt b/mysql-test/t/ssl_cipher-master.opt new file mode 100644 index 00000000000..9525c238c40 --- /dev/null +++ b/mysql-test/t/ssl_cipher-master.opt @@ -0,0 +1 @@ +--ssl-cipher=AES128-SHA diff --git a/mysql-test/t/ssl_cipher.test b/mysql-test/t/ssl_cipher.test new file mode 100644 index 00000000000..5346968175c --- /dev/null +++ b/mysql-test/t/ssl_cipher.test @@ -0,0 +1,23 @@ +# Turn on ssl between the client and server +# and run a number of tests + +--echo # +--echo # BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'" +--echo # + +-- source include/have_ssl.inc + +# Save the initial number of concurrent sessions +--source include/count_sessions.inc + +connect (ssl_con,localhost,root,,,,,SSL); + +# Check Cipher Name and Cipher List +SHOW STATUS LIKE 'Ssl_cipher'; +SHOW STATUS LIKE 'Ssl_cipher_list'; + +connection default; +disconnect ssl_con; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index f60ee247ba7..e910ea09fb2 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -3997,6 +3997,28 @@ DROP TABLE t1,t1s,t2s; --echo End of 5.1 tests --echo # +--echo # Bug #11765713 58705: +--echo # OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES +--echo # CREATED BY OPT_SUM_QUERY +--echo # + +CREATE TABLE t1(a INT NOT NULL, KEY (a)); +INSERT INTO t1 VALUES (0), (1); + +--error ER_SUBQUERY_NO_1_ROW +SELECT 1 as foo FROM t1 WHERE a < SOME + (SELECT a FROM t1 WHERE a <=> + (SELECT a FROM t1) + ); + +SELECT 1 as foo FROM t1 WHERE a < SOME + (SELECT a FROM t1 WHERE a <=> + (SELECT a FROM t1 where a is null) + ); + +DROP TABLE t1; + +--echo # --echo # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): --echo # Assertion `file' failed. --echo # diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test index 573fe0c1810..73491417e0c 100644 --- a/mysql-test/t/subselect_innodb.test +++ b/mysql-test/t/subselect_innodb.test @@ -238,3 +238,12 @@ call p1(); call p1(); drop procedure p1; drop tables t1,t2,t3; + +--echo # +--echo # Bug#60085 crash in Item::save_in_field() with time data type +--echo # + +CREATE TABLE t1(a date, b int, unique(b), unique(a), key(b)) engine=innodb; +INSERT INTO t1 VALUES ('2011-05-13', 0); +SELECT * FROM t1 WHERE b < (SELECT CAST(a as date) FROM t1 GROUP BY a); +DROP TABLE t1; diff --git a/mysql-test/t/tablespace.test b/mysql-test/t/tablespace.test new file mode 100644 index 00000000000..9f3cf6255ac --- /dev/null +++ b/mysql-test/t/tablespace.test @@ -0,0 +1,122 @@ +# +# BUG#60111 storage type for table not saved in .frm +# + +# +# Check that the table options for TABLESPACE and STORAGE +# are printed in SHOW CREATE TABLE +# + +# TABLESPACE only +CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE + STORAGE DISK +CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE + STORAGE MEMORY +CREATE TABLE t1(a int) TABLESPACE ts STORAGE MEMORY ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# STORAGE MEMORY only +CREATE TABLE t1(a int) STORAGE MEMORY ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# STORAGE DISK only +CREATE TABLE t1(a int) STORAGE DISK ENGINE=MyISAM; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# +# Check that the table options for TABLESPACE and STORAGE +# are kept in an ALTER +# + +# TABLESPACE only +CREATE TABLE t1(a int) TABLESPACE ts ENGINE=MyISAM; +ALTER TABLE t1 ADD COLUMN b int; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# TABLESPACE and STORAGE DISK +CREATE TABLE t1(a int) TABLESPACE ts STORAGE DISK ENGINE=MyISAM; +ALTER TABLE t1 ADD COLUMN b int; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# +# Check that the table options for TABLESPACE and STORAGE +# can be changed with an ALTER +# + +# TABLESPACE only +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 TABLESPACE ts; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 TABLESPACE ts2; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# STORAGE only +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 STORAGE MEMORY; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 STORAGE DISK; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# TABLESPACE and STORAGE +CREATE TABLE t1(a int) ENGINE=MyISAM; + +ALTER TABLE t1 STORAGE MEMORY TABLESPACE ts; +SHOW CREATE TABLE t1; + +ALTER TABLE t1 STORAGE DISK TABLESPACE ts2; +SHOW CREATE TABLE t1; + +DROP TABLE t1; + +# +# Check that it's possible to read a .frm fle created +# by MySQL Cluster 7.0(which introduced the new "format +# section) with this statement: +# +# CREATE TABLE cluster_7022_table +# ( +# a int primary key, +# b int, +# c int STORAGE DISK, +# d int STORAGE MEMORY NOT NULL, +# e int COLUMN_FORMAT DYNAMIC, +# f int COLUMN_FORMAT FIXED, +# g int COLUMN_FORMAT DEFAULT, +# h int STORAGE DISK COLUMN_FORMAT DYNAMIC NOT NULL, +# i int STORAGE MEMORY COLUMN_FORMAT DYNAMIC, +# j int STORAGE DISK COLUMN_FORMAT FIXED, +# k int STORAGE MEMORY COLUMN_FORMAT FIXED +# ) STORAGE DISK TABLESPACE the_tablespacename ENGINE=MyISAM; +# +# NOTE! The column level properties will not yet show up +# in SHOW CREATE TABLE of MySQL Server(although they are +# visible in .trace file) +# + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +copy_file std_data/cluster_7022_table.frm $MYSQLD_DATADIR/test/t1.frm; +copy_file std_data/cluster_7022_table.MYD $MYSQLD_DATADIR/test/t1.MYD; +copy_file std_data/cluster_7022_table.MYI $MYSQLD_DATADIR/test/t1.MYI; + +SHOW CREATE TABLE t1; + +DROP TABLE t1; diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test index 3e4c3660f88..e5039c3ea23 100644 --- a/mysql-test/t/trigger.test +++ b/mysql-test/t/trigger.test @@ -998,10 +998,6 @@ call p1(); drop trigger t1_bi; create trigger t1_bi after insert on t1 for each row insert into t3 values (new.id); execute stmt1; -# Until we implement proper mechanism for invalidation of SP statements -# invoked whenever a table used in SP changes, this statement will fail with -# 'Table ... does not exist' error. ---error ER_NO_SUCH_TABLE call p1(); deallocate prepare stmt1; drop procedure p1; diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 6dec86dacab..9a21d8b370d 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -266,6 +266,18 @@ SELECT * FROM t1 JOIN v1 ON addtime( t1.the_date, t1.the_time ) = DROP TABLE t1; DROP VIEW v1; +--echo # +--echo # Bug#59685 crash in String::length with date types +--echo # + +CREATE TABLE t1(a DATE, b YEAR, KEY(a)); +INSERT INTO t1 VALUES ('2011-01-01',2011); + +SELECT b = (SELECT CONVERT(a, DATE) FROM t1 GROUP BY a) FROM t1; +SELECT b = CONVERT((SELECT CONVERT(a, DATE) FROM t1 GROUP BY a), DATE) FROM t1; + +DROP TABLE t1; + --echo End of 5.1 tests --echo # diff --git a/mysql-test/t/variables-notembedded.test b/mysql-test/t/variables-notembedded.test index 7cc068c68c7..b440cfa47b0 100644 --- a/mysql-test/t/variables-notembedded.test +++ b/mysql-test/t/variables-notembedded.test @@ -109,3 +109,30 @@ SET @@session.slave_skip_errors= 7; --error ER_INCORRECT_GLOBAL_LOCAL_VAR SET @@global.slave_skip_errors= 7; # + +--echo # +--echo # Bug #11766769 : 59959: SMALL VALUES OF --MAX-ALLOWED-PACKET +--echo # ARE NOT BEING HONORED +--echo # + +CREATE TABLE t1 (a MEDIUMTEXT); + +SET GLOBAL max_allowed_packet=2048; +SET GLOBAL net_buffer_length=4096; +CONNECT (con1,localhost,root,,test); +SHOW SESSION VARIABLES LIKE 'max_allowed_packet'; +SHOW SESSION VARIABLES LIKE 'net_buffer_length'; +--disable_query_log +--error ER_NET_PACKET_TOO_LARGE +INSERT INTO t1 VALUES ('123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890'); +--enable_query_log + +CONNECTION default; +DISCONNECT con1; +SELECT LENGTH(a) FROM t1; + +SET GLOBAL max_allowed_packet=default; +SET GLOBAL net_buffer_length=default; +DROP TABLE t1; + +--echo End of 5.1 tests diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test index 2b20bbdc13b..ddf1170de93 100644 --- a/mysql-test/t/variables.test +++ b/mysql-test/t/variables.test @@ -1281,12 +1281,31 @@ SET @@global.max_join_size=0; SET @@global.key_buffer_size=0; SET @@global.key_cache_block_size=0; +# +# Bug#56976: added new start-up parameter +# +select @@max_long_data_size; + +--echo # +--echo # Bug#11766424 59527: DECIMAL_BIN_SIZE: ASSERTION `SCALE >= 0 && PRECISION > 0 && SCALE <= PRE +--echo # + +CREATE TABLE t1(f1 DECIMAL(1,1) UNSIGNED); +INSERT INTO t1 VALUES (0.2),(0.1); +SELECT 1 FROM t1 GROUP BY @a:= (SELECT ROUND(f1) FROM t1 WHERE @a=f1); +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT @a:= CAST(1 AS UNSIGNED) AS a; +SHOW CREATE TABLE t1; +DROP TABLE t1; + # 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 c82443e792f..39985bec339 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -3979,6 +3979,18 @@ DROP TABLE t1; CREATE VIEW v1 AS SELECT 1 IN (1 LIKE 2,0) AS f; DROP VIEW v1; +--echo # +--echo # Bug 11829681 - 60295: ERROR 1356 ON VIEW THAT EXECUTES FINE AS A QUERY +--echo # + +CREATE TABLE t1 (a INT); +CREATE VIEW v1 AS SELECT s.* FROM t1 s, t1 b HAVING a; + +SELECT * FROM v1; + +DROP VIEW v1; +DROP TABLE t1; + --echo # ----------------------------------------------------------------- --echo # -- End of 5.1 tests. --echo # ----------------------------------------------------------------- diff --git a/mysql-test/t/warnings.test b/mysql-test/t/warnings.test index 98e1db62d84..5569776904f 100644 --- a/mysql-test/t/warnings.test +++ b/mysql-test/t/warnings.test @@ -228,3 +228,43 @@ DROP TABLE t1; SHOW ERRORS; --echo End of 5.0 tests + +# +# Bug#55847: SHOW WARNINGS returns empty result set when SQLEXCEPTION is active +# + +--echo +--echo -- Bug#55847 +--echo + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP FUNCTION IF EXISTS f1; +--enable_warnings + +CREATE TABLE t1(a INT UNIQUE); + +delimiter |; + +CREATE FUNCTION f1(x INT) RETURNS INT +BEGIN + INSERT INTO t1 VALUES(x); + INSERT INTO t1 VALUES(x); + RETURN x; +END| + +delimiter ;| + +--echo + +--error ER_DUP_ENTRY +SHOW TABLES WHERE f1(11) = 11; + +--echo + +SHOW WARNINGS; + +--echo + +DROP TABLE t1; +DROP FUNCTION f1; diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 47ea4981314..8ce9ce52960 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -3,6 +3,8 @@ # -- source include/have_innodb.inc +--source include/not_embedded.inc + # Save the initial number of concurrent sessions --source include/count_sessions.inc @@ -287,6 +289,98 @@ DROP TABLE t1; disconnect con1; +--echo # +--echo # Bug#11766752 59936: multiple xa assertions - transactional +--echo # statement fuzzer +--echo # + +CREATE TABLE t1 (a INT) engine=InnoDB; +XA START 'a'; +INSERT INTO t1 VALUES (1); + +--error ER_XAER_RMFAIL +SAVEPOINT savep; + +XA END 'a'; +--error ER_XAER_RMFAIL +SELECT * FROM t1; +--error ER_XAER_RMFAIL +INSERT INTO t1 VALUES (2); +--error ER_XAER_RMFAIL +SAVEPOINT savep; +--error ER_XAER_RMFAIL +SET @a=(SELECT * FROM t1); + +XA PREPARE 'a'; +--error ER_XAER_RMFAIL +SELECT * FROM t1; # used to cause InnoDB assert +--error ER_XAER_RMFAIL +INSERT INTO t1 VALUES (2); # used to cause InnoDB assert +--error ER_XAER_RMFAIL +SAVEPOINT savep; +--error ER_XAER_RMFAIL +SET @a=(SELECT * FROM t1); # used to cause InnoDB assert +--error ER_XAER_RMFAIL +UPDATE t1 SET a=1 WHERE a=2; + +XA COMMIT 'a'; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Bug#12352846 - TRANS_XA_START(THD*): +--echo # ASSERTION THD->TRANSACTION.XID_STATE.XID.IS_NULL() +--echo # FAILED +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1, t2; +--enable_warnings + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (a INT); + +START TRANSACTION; +INSERT INTO t1 VALUES (1); + +--echo # Connection con2 +--connect (con2,localhost,root) +XA START 'xid1'; +--echo # Sending: +--send INSERT INTO t2 SELECT a FROM t1 + +--echo # Connection default +--connection default +let $wait_condition= + SELECT COUNT(*) = 1 FROM information_schema.processlist + WHERE state = "Sending data" + AND info = "INSERT INTO t2 SELECT a FROM t1"; +--echo # Waiting until INSERT ... is blocked +--source include/wait_condition.inc +DELETE FROM t1; +COMMIT; + +--echo # Connection con2 +--connection con2 +--echo # Reaping: INSERT INTO t2 SELECT a FROM t1 +--error ER_LOCK_DEADLOCK +--reap +--error ER_XA_RBDEADLOCK +XA COMMIT 'xid1'; +# This caused the assert to be triggered +XA START 'xid1'; + +XA END 'xid1'; +XA PREPARE 'xid1'; +XA ROLLBACK 'xid1'; + +--echo # Connection default +connection default; +DROP TABLE t1, t2; +disconnect con2; + + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc |