diff options
Diffstat (limited to 'mysql-test/t')
27 files changed, 599 insertions, 31 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 5b5fdf50c16..5d71eead642 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1144,3 +1144,18 @@ INSERT INTO t1 VALUES (1, 1), (2, 2); ALTER TABLE t1 CHANGE a id INT; --disable_info DROP TABLE t1; + + +--echo # +--echo # Bug#11754461 CANNOT ALTER TABLE WHEN KEY PREFIX TOO LONG +--echo # + +--disable_warnings +DROP DATABASE IF EXISTS db1; +--enable_warnings + +CREATE DATABASE db1 CHARACTER SET utf8; +CREATE TABLE db1.t1 (bar TINYTEXT, KEY (bar(100))); +ALTER TABLE db1.t1 ADD baz INT; + +DROP DATABASE db1; diff --git a/mysql-test/t/ctype_cp1250_ch.test b/mysql-test/t/ctype_cp1250_ch.test index 1fb656f2a01..a4c59f494a7 100644 --- a/mysql-test/t/ctype_cp1250_ch.test +++ b/mysql-test/t/ctype_cp1250_ch.test @@ -72,3 +72,13 @@ select a from t1 where a like "abcdefgh"; drop table t1; # End of 4.1 tests + +# +# Bug #48053 String::c_ptr has a race and/or does an invalid +# memory reference +# (triggered by Valgrind tests) +# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test) +# +--error 1649 +set global LC_MESSAGES=convert((@@global.log_bin_trust_function_creators) + using cp1250); diff --git a/mysql-test/t/ctype_cp1251.test b/mysql-test/t/ctype_cp1251.test index 3203a1032b4..aae50944456 100644 --- a/mysql-test/t/ctype_cp1251.test +++ b/mysql-test/t/ctype_cp1251.test @@ -65,6 +65,16 @@ DROP TABLE t1; --source include/ctype_8bit.inc +# +# Bug #48053 String::c_ptr has a race and/or does an invalid +# memory reference +# (triggered by Valgrind tests) +# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test) +# +--error 1649 +set global LC_TIME_NAMES=convert((-8388608) using cp1251); + + --echo # --echo # End of 5.1 tests --echo # @@ -76,5 +86,15 @@ DROP TABLE t1; --source include/ctype_numconv.inc --echo # +--echo # Bug#60101 COALESCE with cp1251 tables causes [Err] 1267 - Illegal mix of collations +--echo # +CREATE TABLE t1 (test1 INT, test2 VARCHAR(255)); +SHOW CREATE TABLE t1; +SELECT COALESCE(IF(test1=1, 1, NULL), test2) FROM t1; +SELECT COALESCE(IF(test1=1, NULL, 1), test2) FROM t1; +DROP TABLE t1; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_eucjpms.test b/mysql-test/t/ctype_eucjpms.test index a330925327c..fea48061c69 100644 --- a/mysql-test/t/ctype_eucjpms.test +++ b/mysql-test/t/ctype_eucjpms.test @@ -382,6 +382,16 @@ select hex(convert(_eucjpms 0xA5FE41 using ucs2)); select hex(convert(_eucjpms 0x8FABF841 using ucs2)); +# +# Bug #48053 String::c_ptr has a race and/or does an invalid +# memory reference +# (triggered by Valgrind tests) +# (see also ctype_eucjpms.test, ctype_cp1250.test, ctype_cp1251.test) +# +--error 1649 +set global LC_TIME_NAMES=convert((convert((0x63) using eucjpms)) using utf8); + + --echo # --echo # Start of 5.5 tests --echo # 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_sjis.test b/mysql-test/t/ctype_sjis.test index 103039d0323..f45e6ab9b54 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -92,6 +92,14 @@ INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); DROP TABLE t1; +--echo # +--echo # Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED. +--echo # +# In the below string backslash (0x5C) is a part of a multi-byte +# character, so it should not be quoted. +SELECT QUOTE('\'); + + --echo # End of 5.1 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index a6f3a2c2cbf..24e68f2dab3 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -741,6 +741,12 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +--echo # +SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)); +SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED); + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index ef705474eee..2f1651d0f40 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -745,6 +745,15 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; +--echo # +--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +--echo # +SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END; +SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +DROP TABLE t1; # ## TODO: add tests for all engines diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index b03284a1c7c..10d365572bf 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -831,5 +831,15 @@ SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z'; DROP TABLE t1; --echo # +--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +--echo # +SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END; +SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +DROP TABLE t1; + +--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/file_contents.test b/mysql-test/t/file_contents.test new file mode 100644 index 00000000000..2a112e14495 --- /dev/null +++ b/mysql-test/t/file_contents.test @@ -0,0 +1,56 @@ +# +# Testing files that were built to be packaged, both for existence and for contents +# + +# +# Bug #42969: Create MANIFEST files +# +# Use a Perl script to verify that files "docs/INFO_BIN" and "docs/INFO_SRC" do exist +# and have the expected contents. + +--perl +print "\nChecking 'INFO_SRC' and 'INFO_BIN'\n"; +$dir_docs = $ENV{'MYSQL_BINDIR'}; +if($dir_docs =~ m|/usr/|) { + # RPM package + $dir_docs =~ s|/lib|/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 =~ s|/lib||; + if(-d "$dir_docs/docs") { + $dir_docs = "$dir_docs/docs"; # package + } else { + $dir_docs = "$dir_docs/Docs"; # development tree + } +} +$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"; +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";} +} +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"; +while(defined ($line = <I_BIN>)) { + # "generator" on Windows, "flags" on Unix: + if (($line =~ m| Compiler / generator used: |) || + ($line =~ m| Compiler flags used |)) {$found_compiler = "Found 'Compiler ... used' line";} + if ($line =~ m| Feature flags used:|) {$found_features = "Found 'Feature flags' line";} +} +close I_BIN; +print "INFO_BIN: $found_compiler / $found_features\n"; +EOF + +--echo +--echo End of tests diff --git a/mysql-test/t/filesort_debug.test b/mysql-test/t/filesort_debug.test index 0058a6a3aa7..724ebc90368 100644 --- a/mysql-test/t/filesort_debug.test +++ b/mysql-test/t/filesort_debug.test @@ -1,4 +1,6 @@ --source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/count_sessions.inc SET @old_debug= @@session.debug; @@ -21,3 +23,37 @@ DELETE FROM t1 ORDER BY (f1(10)) LIMIT 1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # Bug #11747102 +--echo # 30771: LOG MORE INFO ABOUT THREADS KILL'D AND SORT ABORTED MESSAGES +--echo # + +connect (con1, localhost, root); +connect (con2, localhost, root); + +--echo # connection 1 +connection con1; +CREATE TABLE t1(f0 int auto_increment primary key, f1 int); +INSERT INTO t1(f1) VALUES (0),(1),(2),(3),(4),(5); + +let $ID= `SELECT @id := CONNECTION_ID()`; + +SET DEBUG_SYNC='filesort_start SIGNAL filesort_started WAIT_FOR filesort_killed'; +--echo # Sending: (not reaped since connection is killed later) +--send SELECT * FROM t1 ORDER BY f1 ASC, f0 + +--echo # connection 2 +connection con2; +let $ignore= `SELECT @id := $ID`; +SET DEBUG_SYNC='now WAIT_FOR filesort_started'; +KILL @id; +SET DEBUG_SYNC='now SIGNAL filesort_killed'; + +--echo # connection default +connection default; +disconnect con1; +disconnect con2; +--source include/wait_until_count_sessions.inc +SET DEBUG_SYNC= "RESET"; +DROP TABLE t1; 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/func_encrypt_ucs2.test b/mysql-test/t/func_encrypt_ucs2.test new file mode 100644 index 00000000000..8b4cd44d354 --- /dev/null +++ b/mysql-test/t/func_encrypt_ucs2.test @@ -0,0 +1,12 @@ +-- source include/have_ssl_crypto_functs.inc +-- source include/have_ucs2.inc + +--echo # +--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +--echo # + +SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2))); +SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED); + +SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))); +SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED); 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 eaa592c2ad5..f53d90cef96 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -881,4 +881,11 @@ SELECT WEEK(STR_TO_DATE(NULL,0)); SELECT SUBDATE(STR_TO_DATE(NULL,0), INTERVAL 1 HOUR); --echo # +--echo # BUG#59895 - setting storage engine to null segfaults mysqld +--echo # +SELECT MONTHNAME(0), MONTHNAME(0) IS NULL, MONTHNAME(0) + 1; +--error ER_WRONG_VALUE_FOR_VAR +SET storage_engine=NULL; + +--echo # diff --git a/mysql-test/t/gis.test b/mysql-test/t/gis.test index 520da7e62c9..fe6da647740 100644 --- a/mysql-test/t/gis.test +++ b/mysql-test/t/gis.test @@ -757,6 +757,17 @@ 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 # +--echo # Test for bug #59888 "debug assertion when attempt to create spatial index +--echo # on char > 31 bytes". +--echo # +create table t1(a char(32) not null) engine=myisam; +--error ER_SPATIAL_MUST_HAVE_GEOM_COL +create spatial index i on t1 (a); +drop table t1; + + --echo End of 5.1 tests # diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index 282b286749a..0c2da4ae9f4 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1248,6 +1248,43 @@ ON 1 WHERE t2.f1 > 1 GROUP BY t2.f1; DROP TABLE t1; +--echo # +--echo # Bug#59839: Aggregation followed by subquery yields wrong result +--echo # + +CREATE TABLE t1 ( + a INT, + b INT, + c INT, + KEY (a, b) +); + +INSERT INTO t1 VALUES + ( 1, 1, 1 ), + ( 1, 2, 2 ), + ( 1, 3, 3 ), + ( 1, 4, 6 ), + ( 1, 5, 5 ), + ( 1, 9, 13 ), + + ( 2, 1, 6 ), + ( 2, 2, 7 ), + ( 2, 3, 8 ); + +EXPLAIN +SELECT a, AVG(t1.b), +(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c, +(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c +FROM t1 GROUP BY a; + +SELECT a, AVG(t1.b), +(SELECT t11.c FROM t1 t11 WHERE t11.a = t1.a AND t11.b = AVG(t1.b)) AS t11c, +(SELECT t12.c FROM t1 t12 WHERE t12.a = t1.a AND t12.b = AVG(t1.b)) AS t12c +FROM t1 GROUP BY a; + +DROP TABLE t1; + + --echo # End of 5.1 tests --echo # diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test index a8925306c70..bf1e5de1587 100644 --- a/mysql-test/t/innodb_mysql_sync.test +++ b/mysql-test/t/innodb_mysql_sync.test @@ -253,26 +253,23 @@ connection con1; --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 # 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 +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; diff --git a/mysql-test/t/insert_select.test b/mysql-test/t/insert_select.test index 7318e45889a..d7fe816bec7 100644 --- a/mysql-test/t/insert_select.test +++ b/mysql-test/t/insert_select.test @@ -407,7 +407,7 @@ SET GLOBAL myisam_data_pointer_size = 2; INSERT INTO t1 VALUES (1), (2), (3), (4), (5); -call mtr.add_suppression("mysqld: The table '.*#sql.*' is full"); +call mtr.add_suppression("mysqld.*: The table '.*#sql.*' is full"); --error ER_RECORD_FILE_FULL,ER_RECORD_FILE_FULL INSERT IGNORE INTO t1 SELECT t1.a FROM t1,t1 t2,t1 t3,t1 t4,t1 t5,t1 t6,t1 t7; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 0e2abe578ce..496d045075a 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -683,4 +683,24 @@ UPDATE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; DROP FUNCTION f1; DROP TABLE t1; +--echo # +--echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a +--echo # table is updated twice +--echo # + +# Results differ between storage engines. +# See multi_update_innodb.test for the InnoDB variant of this test +CREATE TABLE t1( + pk INT, + a INT, + PRIMARY KEY (pk) +) ENGINE=MyISAM; + +INSERT INTO t1 VALUES (0,0); +UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2; +--echo +--echo # Should be (1,2) +SELECT * FROM t1; +DROP TABLE t1; + --echo end of tests diff --git a/mysql-test/t/multi_update_innodb.test b/mysql-test/t/multi_update_innodb.test new file mode 100644 index 00000000000..3148d009cef --- /dev/null +++ b/mysql-test/t/multi_update_innodb.test @@ -0,0 +1,33 @@ +--source include/have_innodb.inc + +--echo # +--echo # BUG#57373: Multi update+InnoDB reports ER_KEY_NOT_FOUND if a +--echo # table is updated twice +--echo # + +# Results differ between storage engines. +# See multi_update.test for the MyISAM variant of this test +CREATE TABLE t1( + pk INT, + a INT, + b INT, + PRIMARY KEY (pk) +) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (0,0,0); +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE t1 AS A, t1 AS B SET A.pk = 1, B.a = 2; +SELECT * FROM t1; + +CREATE VIEW v1 AS SELECT * FROM t1; +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE v1 AS A, t1 AS B SET A.pk = 1, B.a = 2; +SELECT * FROM t1; + +UPDATE t1 AS A, t1 AS B SET A.a = 1, B.b = 2; +--echo # Should be (0,1,2) +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + 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 8ffa2e164cd..44245eb9d44 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -2179,6 +2179,27 @@ CREATE TABLE `comment_table` (i INT COMMENT 'FIELD COMMENT') COMMENT = 'TABLE CO DROP TABLE `comment_table`; --echo # +--echo # BUG#11766310 : 59398: MYSQLDUMP 5.1 CAN'T HANDLE A DASH ("-") IN +--echo # DATABASE NAMES IN ALTER DATABASE +--echo # + +CREATE DATABASE `test-database`; +USE `test-database`; +CREATE TABLE `test` (`c1` VARCHAR(10)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +DELIMITER |; +CREATE TRIGGER `trig` BEFORE INSERT ON `test` FOR EACH ROW BEGIN +END | +DELIMITER ;| + +ALTER DATABASE `test-database` CHARACTER SET latin1 COLLATE latin1_swedish_ci; +ALTER DATABASE `test-database` CHARACTER SET utf8 COLLATE utf8_unicode_ci ; + +--exec $MYSQL_DUMP --quote-names --compact test-database + +DROP DATABASE `test-database`; + +--echo # --echo # End of 5.1 tests --echo # diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index 21c385485cc..f2e8cbb2da2 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -2267,3 +2267,53 @@ DROP TABLE t1; SET GLOBAL myisam_use_mmap=default; --echo End of 5.1 tests + +--echo # +--echo # BUG#55385: UPDATE statement throws an error, but still updates +--echo # the table entries + +CREATE TABLE t1_part ( + partkey int, + nokey int +) PARTITION BY LINEAR HASH(partkey) PARTITIONS 3; + +INSERT INTO t1_part VALUES (1, 1) , (10, 10); +CREATE VIEW v1 AS SELECT * FROM t1_part; + +--echo +--echo # Should be (1,1),(10,10) +SELECT * FROM t1_part; + +--echo +--echo # Case 1 +--echo # Update is refused because partitioning key is updated +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.partkey = 2, B.nokey = 3; +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2, B.partkey = 3; + +--echo +--echo # Case 2 +--echo # Like 1, but partition accessed through a view +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE t1_part AS A NATURAL JOIN v1 as B SET A.nokey = 2 , B.partkey = 3; +--error ER_MULTI_UPDATE_KEY_CONFLICT +UPDATE v1 AS A NATURAL JOIN t1_part as B SET A.nokey = 2 , B.partkey = 3; + +--echo +--echo # Should be (1,1),(10,10) +SELECT * FROM t1_part; + +--echo +--echo # Case 3 +--echo # Update is accepted because partitioning key is not updated +UPDATE t1_part AS A NATURAL JOIN t1_part B SET A.nokey = 2 , B.nokey = 3; + +--echo +--echo # Should be (1,3),(10,3) +SELECT * FROM t1_part; + +--echo +# Cleanup +DROP VIEW v1; +DROP TABLE t1_part; diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test index 3fd243398a9..47ea4981314 100644 --- a/mysql-test/t/xa.test +++ b/mysql-test/t/xa.test @@ -245,6 +245,48 @@ XA PREPARE 'x'; XA ROLLBACK 'x'; +--echo # +--echo # Bug#59986 Assert in Diagnostics_area::set_ok_status() for XA COMMIT +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1(a INT, b INT, PRIMARY KEY(a)) engine=InnoDB; +INSERT INTO t1 VALUES (1, 1), (2, 2); + +--echo # Connection con1 +connect (con1, localhost, root); +XA START 'a'; +UPDATE t1 SET b= 3 WHERE a=1; + +--echo # Connection default +connection default; +XA START 'b'; +UPDATE t1 SET b=4 WHERE a=2; +--echo # Sending: +--send UPDATE t1 SET b=5 WHERE a=1 + +--echo # Connection con1 +connection con1; +--sleep 1 +--error ER_LOCK_DEADLOCK +UPDATE t1 SET b=6 WHERE a=2; +# This used to trigger the assert +--error ER_XA_RBDEADLOCK +XA COMMIT 'a'; + +--echo # Connection default +connection default; +--echo # Reaping: UPDATE t1 SET b=5 WHERE a=1 +--reap +XA END 'b'; +XA ROLLBACK 'b'; +DROP TABLE t1; +disconnect con1; + + # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 3bc580fe4e5..89c0b8992b1 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -646,6 +646,11 @@ SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1'); +--echo # +--echo # Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332 +--echo # +SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1); + --echo End of 5.1 tests |