summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorAlexander Nozdrin <alik@sun.com>2010-05-28 09:47:58 +0400
committerAlexander Nozdrin <alik@sun.com>2010-05-28 09:47:58 +0400
commit59a99129634a020bc618324db1c36f36f9e14493 (patch)
tree88543c956886365a2376e01ce26a0436c38a4454 /mysql-test/t
parent7758bdc8aad36927db408b4bc9546d39ef646c3c (diff)
parenteb27f163a31ca6995c98ada9fc678176c041dd93 (diff)
downloadmariadb-git-59a99129634a020bc618324db1c36f36f9e14493.tar.gz
Auto-merge from mysql-trunk.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/archive.test23
-rw-r--r--mysql-test/t/bug46261-master.opt1
-rw-r--r--mysql-test/t/bug46261.test16
-rw-r--r--mysql-test/t/ctype_ucs.test9
-rw-r--r--mysql-test/t/delete.test12
-rw-r--r--mysql-test/t/error_simulation.test16
-rw-r--r--mysql-test/t/explain.test13
-rw-r--r--mysql-test/t/fulltext.test9
-rw-r--r--mysql-test/t/func_concat.test20
-rw-r--r--mysql-test/t/func_gconcat.test12
-rw-r--r--mysql-test/t/func_str.test11
-rw-r--r--mysql-test/t/gis-rtree.test15
-rw-r--r--mysql-test/t/grant.test24
-rw-r--r--mysql-test/t/group_by.test15
-rw-r--r--mysql-test/t/handler_myisam.test11
-rw-r--r--mysql-test/t/having.test45
-rw-r--r--mysql-test/t/innodb_mysql.test60
-rw-r--r--mysql-test/t/join.test45
-rw-r--r--mysql-test/t/join_outer.test23
-rw-r--r--mysql-test/t/loaddata.test25
-rw-r--r--mysql-test/t/log_state.test38
-rw-r--r--mysql-test/t/mysqlbinlog.test11
-rw-r--r--mysql-test/t/mysqldump.test30
-rw-r--r--mysql-test/t/outfile_loaddata.test34
-rw-r--r--mysql-test/t/partition.test12
-rw-r--r--mysql-test/t/ps.test14
-rw-r--r--mysql-test/t/query_cache_with_views.test17
-rw-r--r--mysql-test/t/range.test41
-rw-r--r--mysql-test/t/renamedb.test2
-rw-r--r--mysql-test/t/row.test11
-rw-r--r--mysql-test/t/skip_name_resolve.test21
-rw-r--r--mysql-test/t/subselect.test83
-rw-r--r--mysql-test/t/symlink.test22
-rw-r--r--mysql-test/t/trigger.test44
-rw-r--r--mysql-test/t/upgrade.test34
-rw-r--r--mysql-test/t/variables.test8
-rw-r--r--mysql-test/t/variables_debug.test16
-rw-r--r--mysql-test/t/view.test9
38 files changed, 827 insertions, 25 deletions
diff --git a/mysql-test/t/archive.test b/mysql-test/t/archive.test
index b2545e98f3e..5b61176b0f6 100644
--- a/mysql-test/t/archive.test
+++ b/mysql-test/t/archive.test
@@ -1669,3 +1669,26 @@ FLUSH TABLE t1;
SELECT * FROM t1;
--error ER_BAD_TABLE_ERROR
DROP TABLE t1;
+
+
+--echo #
+--echo # BUG#46565 - repair of partition fail for archive engine
+--echo #
+--echo # Installing corrupted table files for t1.
+# bug46565 was created, filled and damaged as following:
+# CREATE TABLE bug46565(a INT) ENGINE=archive;
+# INSERT INTO bug46565 VALUES(1);
+# FLUSH TABLE bug46565;
+# INSERT INTO bug46565 VALUES(2),(3);
+# FLUSH TABLE bug46565;
+# dd if=bug46565.ARZ of=std_data/bug46565.ARZ bs=1 count=8670
+copy_file std_data/bug46565.frm $MYSQLD_DATADIR/test/t1.frm;
+copy_file std_data/bug46565.ARZ $MYSQLD_DATADIR/test/t1.ARZ;
+--error ER_CRASHED_ON_USAGE
+SELECT * FROM t1;
+REPAIR TABLE t1;
+--error ER_CRASHED_ON_USAGE
+SELECT * FROM t1;
+REPAIR TABLE t1 EXTENDED;
+SELECT * FROM t1;
+DROP TABLE t1;
diff --git a/mysql-test/t/bug46261-master.opt b/mysql-test/t/bug46261-master.opt
new file mode 100644
index 00000000000..6be4269e809
--- /dev/null
+++ b/mysql-test/t/bug46261-master.opt
@@ -0,0 +1 @@
+--skip-grant-tables $EXAMPLE_PLUGIN_OPT
diff --git a/mysql-test/t/bug46261.test b/mysql-test/t/bug46261.test
new file mode 100644
index 00000000000..67bdc995850
--- /dev/null
+++ b/mysql-test/t/bug46261.test
@@ -0,0 +1,16 @@
+--source include/not_embedded.inc
+--source include/have_example_plugin.inc
+
+--echo #
+--echo # Bug#46261 Plugins can be installed with --skip-grant-tables
+--echo #
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval UNINSTALL PLUGIN example;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test
index 8d4b478e68d..a6f3a2c2cbf 100644
--- a/mysql-test/t/ctype_ucs.test
+++ b/mysql-test/t/ctype_ucs.test
@@ -732,6 +732,15 @@ SELECT HEX(MONTHNAME(19700101));
SELECT HEX(DAYNAME(19700101));
SET character_set_connection=latin1;
+--echo #
+--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+--echo #
+CREATE TABLE t1 (a CHAR(1) CHARSET ascii, b CHAR(1) CHARSET latin1);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index acd67e0e766..a21fff60d33 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -527,5 +527,17 @@ DELETE IGNORE FROM t1;
DROP TABLE t1;
+--echo #
+--echo # Bug #53450: Crash/assertion
+--echo # "virtual int ha_myisam::index_first(uchar*)") at assert.c:81
+--echo #
+
+CREATE TABLE t1 (a INT, b INT, c INT,
+ INDEX(a), INDEX(b), INDEX(c));
+INSERT INTO t1 VALUES (1,2,3), (4,5,6), (7,8,9);
+
+DELETE FROM t1 WHERE a = 10 OR b = 20 ORDER BY c LIMIT 1;
+
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index f730c95208e..7cd16a6bc5a 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -33,3 +33,19 @@ set tmp_table_size=default;
DROP TABLE t1;
+--echo #
+--echo # Bug #50946: fast index creation still seems to copy the table
+--echo #
+CREATE TABLE t1 (a INT(100) NOT NULL);
+INSERT INTO t1 VALUES (1), (0), (2);
+SET SESSION debug='+d,alter_table_only_index_change';
+ALTER TABLE t1 ADD INDEX a(a);
+SET SESSION debug=DEFAULT;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 5.1 tests
+--echo #
diff --git a/mysql-test/t/explain.test b/mysql-test/t/explain.test
index 30366f6f67e..72406110de1 100644
--- a/mysql-test/t/explain.test
+++ b/mysql-test/t/explain.test
@@ -210,4 +210,17 @@ explain extended select * from t1 where f1=1;
explain extended select * from t1 join t2 on f1=f2 where f1=1;
drop table t1,t2;
+--echo #
+--echo # Bug #48419: another explain crash..
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b BLOB, KEY b(b(100)));
+INSERT INTO t2 VALUES ('1'), ('2'), ('3');
+
+FLUSH TABLES;
+
+EXPLAIN SELECT 1 FROM t1 WHERE a = (SELECT 1 FROM t1 t JOIN t2 WHERE b <= 1 AND t.a);
+
+DROP TABLE t1, t2;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index 97a1b5e39dc..388b1432390 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -584,5 +584,14 @@ CREATE TABLE t1(a CHAR(1),FULLTEXT(a));
SELECT 1 FROM t1 WHERE MATCH(a) AGAINST ('') AND ROW(a,a) > ROW(1,1);
DROP TABLE t1;
+--echo #
+--echo # BUG#51866 - crash with repair by sort and fulltext keys
+--echo #
+CREATE TABLE t1(a CHAR(4), FULLTEXT(a));
+INSERT INTO t1 VALUES('aaaa');
+SET myisam_sort_buffer_size=4;
+REPAIR TABLE t1;
+SET myisam_sort_buffer_size=@@global.myisam_sort_buffer_size;
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_concat.test b/mysql-test/t/func_concat.test
index e24b4354b61..e56d1121808 100644
--- a/mysql-test/t/func_concat.test
+++ b/mysql-test/t/func_concat.test
@@ -124,4 +124,24 @@ SELECT @query;
DROP PROCEDURE p1;
+--echo #
+--echo # Bug #40625: Concat fails on DOUBLE values in a Stored Procedure,
+--echo # while DECIMAL works
+--echo #
+
+DELIMITER //;
+CREATE PROCEDURE p1()
+BEGIN
+ DECLARE v1 DOUBLE(10,3);
+ SET v1= 100;
+ SET @s = CONCAT('########################################', 40 , v1);
+ SELECT @s;
+END;//
+DELIMITER ;//
+
+CALL p1();
+CALL p1();
+
+DROP PROCEDURE p1;
+
--echo # End of 5.1 tests
diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test
index 0b4f0be114c..e191b9750e3 100644
--- a/mysql-test/t/func_gconcat.test
+++ b/mysql-test/t/func_gconcat.test
@@ -708,6 +708,18 @@ SELECT 1 FROM
DROP TABLE t1;
+
+--echo #
+--echo # Bug #52397: another crash with explain extended and group_concat
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (0);
+EXPLAIN EXTENDED SELECT 1 FROM
+ (SELECT GROUP_CONCAT(t1.a ORDER BY t1.a ASC) FROM
+ t1 t2, t1 GROUP BY t1.a) AS d;
+DROP TABLE t1;
+
+
--echo End of 5.0 tests
#
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 556a19efce5..10d35b16315 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -1354,6 +1354,17 @@ SELECT DECODE((SELECT ENCODE('secret', t1.a) FROM t1,t2 WHERE t1.a = t2.a GROUP
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#52164 Assertion failed: param.sort_length, file .\filesort.cc, line 149
+--echo #
+CREATE TABLE t1 (a LONGBLOB NOT NULL);
+INSERT INTO t1 VALUES (''),('');
+SELECT 1 FROM t1, t1 t2
+ORDER BY QUOTE(t1.a);
+DROP TABLE t1;
+
+--echo End of 5.1 tests
+
--echo Start of 5.4 tests
#
# WL#4584 Internationalized number format
diff --git a/mysql-test/t/gis-rtree.test b/mysql-test/t/gis-rtree.test
index c5d5bfee861..b006096528e 100644
--- a/mysql-test/t/gis-rtree.test
+++ b/mysql-test/t/gis-rtree.test
@@ -914,14 +914,15 @@ HANDLER t1 READ a PREV;
HANDLER t1 READ a LAST;
HANDLER t1 CLOSE;
-#TODO: re-enable this test please when bug #51877 is solved
# second crash fixed when the tree has changed since the last search.
-#HANDLER t1 OPEN;
-#HANDLER t1 READ a FIRST;
-#INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
-#HANDLER t1 READ a NEXT;
-#HANDLER t1 CLOSE;
-#TODO: end of the 51877 dependent section
+HANDLER t1 OPEN;
+HANDLER t1 READ a FIRST;
+INSERT INTO t1 VALUES (GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
+--echo # should not crash
+--disable_result_log
+HANDLER t1 READ a NEXT;
+--enable_result_log
+HANDLER t1 CLOSE;
DROP TABLE t1;
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index bda48fb9ecf..de43d6a74b4 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -1554,6 +1554,30 @@ connection default;
disconnect conn1;
+#
+# Bug #53371: COM_FIELD_LIST can be abused to bypass table level grants.
+#
+
+CREATE DATABASE db1;
+CREATE DATABASE db2;
+GRANT SELECT ON db1.* to 'testbug'@localhost;
+USE db2;
+CREATE TABLE t1 (a INT);
+USE test;
+connect (con1,localhost,testbug,,db1);
+--error ER_NO_SUCH_TABLE
+SELECT * FROM `../db2/tb2`;
+--error ER_TABLEACCESS_DENIED_ERROR
+SELECT * FROM `../db2`.tb2;
+--error ER_NO_SUCH_TABLE
+SELECT * FROM `#mysql50#/../db2/tb2`;
+connection default;
+disconnect con1;
+DROP USER 'testbug'@localhost;
+DROP TABLE db2.t1;
+DROP DATABASE db1;
+DROP DATABASE db2;
+
# Wait till we reached the initial number of concurrent sessions
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 4f92ff65177..f90c1dc3c58 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1206,6 +1206,21 @@ SELECT (SELECT t2.a FROM t2 WHERE t2.a = t1.a) aa, b, COUNT( b)
DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#52051: Aggregate functions incorrectly returns NULL from outer
+--echo # join query
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY);
+CREATE TABLE t2 (a INT PRIMARY KEY);
+INSERT INTO t2 VALUES (1), (2);
+EXPLAIN SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+SELECT MIN(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+EXPLAIN SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+SELECT MAX(t2.a) FROM t2 LEFT JOIN t1 ON t2.a = t1.a;
+DROP TABLE t1, t2;
+
+
--echo #
--echo # End of 5.1 tests
diff --git a/mysql-test/t/handler_myisam.test b/mysql-test/t/handler_myisam.test
index da02a90af0f..868ba14480a 100644
--- a/mysql-test/t/handler_myisam.test
+++ b/mysql-test/t/handler_myisam.test
@@ -37,4 +37,15 @@ TRUNCATE t1;
HANDLER t1 READ FIRST;
DROP TABLE t1;
+--echo #
+--echo # BUG#51877 - HANDLER interface causes invalid memory read
+--echo #
+CREATE TABLE t1(a INT, KEY(a));
+HANDLER t1 OPEN;
+HANDLER t1 READ a FIRST;
+INSERT INTO t1 VALUES(1);
+HANDLER t1 READ a NEXT;
+HANDLER t1 CLOSE;
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index b68ba69b975..65bf9518a5c 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -498,4 +498,49 @@ HAVING (table2.f2 = 8);
DROP TABLE t1;
+--echo #
+--echo # Bug#52336 Segfault / crash in 5.1 copy_fields (param=0x9872980) at sql_select.cc:15355
+--echo #
+CREATE TABLE t1(f1 INT, f2 INT);
+INSERT INTO t1 VALUES (10,8);
+CREATE TABLE t2 (f1 INT);
+INSERT INTO t2 VALUES (5);
+
+SELECT COUNT(f1) FROM t2
+HAVING (7, 9) IN (SELECT f1, MIN(f2) FROM t1);
+
+DROP TABLE t1, t2;
+
+CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
+INSERT INTO t1 VALUES (16,'f');
+INSERT INTO t1 VALUES (16,'f');
+CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
+INSERT INTO t2 VALUES (13,'f');
+INSERT INTO t2 VALUES (20,'f');
+CREATE TABLE t3 (f1 INT, f2 VARCHAR(1));
+INSERT INTO t3 VALUES (7,'f');
+
+SELECT t1.f2 FROM t1
+STRAIGHT_JOIN (t2 JOIN t3 ON t3.f2 = t2.f2 ) ON t3 .f2 = t2 .f2
+HAVING ('v', 'i') NOT IN (SELECT f2, MIN(f2) FROM t1)
+ORDER BY f2;
+
+DROP TABLES t1,t2,t3;
+
+--echo #
+--echo # Bug#52340 Segfault: read_cached_record (tab=0x94a2634) at sql_select.cc:14411
+--echo #
+CREATE TABLE t1 (f1 INT, f2 VARCHAR(1));
+INSERT INTO t1 VALUES (16,'d');
+CREATE TABLE t2 (f1 INT, f2 VARCHAR(1));
+INSERT INTO t2 VALUES (13,'e');
+INSERT INTO t2 VALUES (20,'d');
+
+SELECT MAX(t2.f2) FROM t2 JOIN t1 ON t1.f2
+HAVING ('e' , 'd') IN
+(SELECT ts1.f2, ts2.f2 FROM t2 ts1 JOIN t2 ts2 ON ts1.f1)
+ORDER BY t1.f2;
+
+DROP TABLE t1,t2;
+
--echo End of 5.0 tests
diff --git a/mysql-test/t/innodb_mysql.test b/mysql-test/t/innodb_mysql.test
index 63eff93ba7f..f2c770cce42 100644
--- a/mysql-test/t/innodb_mysql.test
+++ b/mysql-test/t/innodb_mysql.test
@@ -589,6 +589,66 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE INDEX k (a,b);
DROP TABLE t1;
+
+--echo #
+--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when
+--echo # JOINed during an UPDATE
+--echo #
+
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT,
+ c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+
+--echo set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+SELECT SLEEP(1);
+
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+
+--echo #should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug #53334: wrong result for outer join with impossible ON condition
+--echo # (see the same test case for MyISAM in join.test)
+--echo #
+
+CREATE TABLE t1 (id INT PRIMARY KEY);
+CREATE TABLE t2 (id INT);
+
+INSERT INTO t1 VALUES (75);
+INSERT INTO t1 VALUES (79);
+INSERT INTO t1 VALUES (78);
+INSERT INTO t1 VALUES (77);
+REPLACE INTO t1 VALUES (76);
+REPLACE INTO t1 VALUES (76);
+INSERT INTO t1 VALUES (104);
+INSERT INTO t1 VALUES (103);
+INSERT INTO t1 VALUES (102);
+INSERT INTO t1 VALUES (101);
+INSERT INTO t1 VALUES (105);
+INSERT INTO t1 VALUES (106);
+INSERT INTO t1 VALUES (107);
+
+INSERT INTO t2 VALUES (107),(75),(1000);
+
+SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+ WHERE t2.id=75 AND t1.id IS NULL;
+EXPLAIN SELECT t1.id,t2.id FROM t2 LEFT JOIN t1 ON t1.id>=74 AND t1.id<=0
+ WHERE t2.id=75 AND t1.id IS NULL;
+
+DROP TABLE t1,t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 761121313e5..43b373c9703 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -784,6 +784,40 @@ FROM
DROP TABLE t1,t2,t3,t4,t5,t6;
+--echo #
+--echo # Bug#48483: crash in get_best_combination()
+--echo #
+
+CREATE TABLE t1(f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE VIEW v1 AS SELECT 1 FROM t1 LEFT JOIN t1 AS t2 on 1=1;
+EXPLAIN EXTENDED
+SELECT 1 FROM v1 right join v1 AS v2 ON RAND();
+DROP VIEW v1;
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#52177 crash with explain, row comparison, join, text field
+--echo #
+CREATE TABLE t1 (a TINYINT, b TEXT, KEY (a));
+INSERT INTO t1 VALUES (0,''),(0,'');
+FLUSH TABLES;
+EXPLAIN SELECT 1 FROM t1 LEFT JOIN t1 a ON 1
+WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 1111.11) AND
+ROW(t1.b, 1111.11) <=> ROW('','');
+DROP TABLE t1;
+
+--echo #
+--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
+--echo #
+
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (0,0), (1,1);
+
+SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
+
+DROP TABLE t1;
+
--echo End of 5.0 tests.
@@ -817,15 +851,4 @@ ENGINE=MERGE UNION=(t1,t2);
SELECT t1.a FROM mm1,t1;
DROP TABLE t1, t2, mm1;
---echo #
---echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
---echo #
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-
-DROP TABLE t1;
-
--echo End of 5.1 tests
diff --git a/mysql-test/t/join_outer.test b/mysql-test/t/join_outer.test
index e3d68d71603..aaea8b3120b 100644
--- a/mysql-test/t/join_outer.test
+++ b/mysql-test/t/join_outer.test
@@ -913,4 +913,27 @@ WHERE (COALESCE(t1.f1, t2.f1), f3) IN ((1, 3), (2, 2));
DROP TABLE t1, t2;
+--echo #
+--echo # Bug#52357: Assertion failed: join->best_read in greedy_search
+--echo # optimizer_search_depth=0
+--echo #
+CREATE TABLE t1( a INT );
+
+INSERT INTO t1 VALUES (1),(2);
+SET optimizer_search_depth = 0;
+
+--echo # Should not core dump on query preparation
+EXPLAIN
+SELECT 1
+FROM t1 tt3 LEFT OUTER JOIN t1 tt4 ON 1
+ LEFT OUTER JOIN t1 tt5 ON 1
+ LEFT OUTER JOIN t1 tt6 ON 1
+ LEFT OUTER JOIN t1 tt7 ON 1
+ LEFT OUTER JOIN t1 tt8 ON 1
+ RIGHT OUTER JOIN t1 tt2 ON 1
+ RIGHT OUTER JOIN t1 tt1 ON 1
+ STRAIGHT_JOIN t1 tt9 ON 1;
+
+SET optimizer_search_depth = DEFAULT;
+DROP TABLE t1;
--echo End of 5.1 tests
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 7bfe2491c7c..c10a7d82c43 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -153,10 +153,6 @@ select * from t1;
#
# It should not be possible to load from a file outside of vardir
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-show variables like "secure_file_pri%";
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
-select @@secure_file_priv;
--error 1238
set @@secure_file_priv= 0;
@@ -502,6 +498,13 @@ set session sql_mode=@OLD_SQL_MODE;
DROP TABLE t1,t2;
+--echo #
+--echo # Bug #51893: crash with certain characters given to load_file
+--echo # function on windows
+--echo #
+
+select load_file(0x0A9FB76C661B409C4BEC88098C5DD71B1072F9691F2E827D7EC8F092B299868A3CE196C04F0FB18CAB4E1557EB72331D812379DE7A75CA21C32E7C722C59E5CC33EF262EF04187B0F0EE756FA984DF2EAD37B1E4ADB064C3C5038F2E3B2D661B1C1150AAEB5425512E14D7506166D92D4533872E662F4B2D1428AAB5CCA72E75AA2EF325E196A5A02E2E8278873C64375845994B0F39BE2FF7B478332A7B0AA5E48877C47B6F513E997848AF8CCB8A899F3393AB35333CF0871E36698193862D486B4B9078B70C0A0A507B8A250F3F876F5A067632D5E65193E4445A1EC3A2C9B4C6F07AC334F0F62BC33357CB502E9B1C19D2398B6972AEC2EF21630F8C9134C4F7DD662D8AD7BDC9E19C46720F334B66C22D4BF32ED275144E20E7669FFCF6FC143667C9F02A577F32960FA9F2371BE1FA90E49CBC69C01531F140556854D588DD0E55E1307D78CA38E975CD999F9AEA604266329EE62BFB5ADDA67F549E211ECFBA906C60063696352ABB82AA782D25B17E872EA587871F450446DB1BAE0123D20404A8F2D2698B371002E986C8FCB969A99FF0E150A2709E2ED7633D02ADA87D5B3C9487D27B2BD9D21E2EC3215DCC3CDCD884371281B95A2E9987AAF82EB499C058D9C3E7DC1B66635F60DB121C72F929622DD47B6B2E69F59FF2AE6B63CC2EC60FFBA20EA50569DBAB5DAEFAEB4F03966C9637AB55662EDD28439155A82D053A5299448EDB2E7BEB0F62889E2F84E6C7F34B3212C9AAC32D521D5AB8480993F1906D5450FAB342A0FA6ED223E178BAC036B81E15783604C32A961EA1EF20BE2EBB93D34ED37BC03142B7583303E4557E48551E4BD7CBDDEA146D5485A5D212C35189F0BD6497E66912D2780A59A53B532E12C0A5ED1EC0445D96E8F2DD825221CFE4A65A87AA21DC8750481B9849DD81694C3357A0ED9B78D608D8EDDE28FAFBEC17844DE5709F41E121838DB55639D77E32A259A416D7013B2EB1259FDE1B498CBB9CAEE1D601DF3C915EA91C69B44E6B72062F5F4B3C73F06F2D5AD185E1692E2E0A01E7DD5133693681C52EE13B2BE42D03BDCF48E4E133CF06662339B778E1C3034F9939A433E157449172F7969ACCE1F5D2F65A4E09E4A5D5611EBEDDDBDB0C0C0A);
+
--echo End of 5.0 tests
@@ -532,5 +535,19 @@ SET character_set_filesystem=default;
select @@character_set_filesystem;
+--echo #
+--echo # Bug #51850: crash/memory overlap when using load data infile and set
+--echo # col equal to itself!
+--echo #
+
+CREATE TABLE t1(col0 LONGBLOB);
+SELECT 'test' INTO OUTFILE 't1.txt';
+LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0;
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/t1.txt;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/log_state.test b/mysql-test/t/log_state.test
index 4d8c8fc6e74..d47044fbbee 100644
--- a/mysql-test/t/log_state.test
+++ b/mysql-test/t/log_state.test
@@ -313,6 +313,42 @@ SET @@global.general_log_file = @old_general_log_file;
SET @@global.slow_query_log = @old_slow_query_log;
SET @@global.slow_query_log_file = @old_slow_query_log_file;
+###########################################################################
+
+--echo #
+--echo # Bug #49756 Rows_examined is always 0 in the slow query log
+--echo # for update statements
+--echo #
+
+SET @old_log_output = @@global.log_output;
+SET GLOBAL log_output = "TABLE";
+SET GLOBAL slow_query_log = ON;
+SET GLOBAL long_query_time = 0.001;
+
+# clear slow_log of any residual slow queries
+TRUNCATE TABLE mysql.slow_log;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, PRIMARY KEY (b));
+INSERT INTO t2 VALUES (3),(4);
+
+connect (con2,localhost,root,,);
+INSERT INTO t1 VALUES (1+sleep(.01)),(2);
+INSERT INTO t1 SELECT b+sleep(.01) from t2;
+UPDATE t1 SET a=a+sleep(.01) WHERE a>2;
+UPDATE t1 SET a=a+sleep(.01) ORDER BY a DESC;
+UPDATE t2 set b=b+sleep(.01) limit 1;
+UPDATE t1 SET a=a+sleep(.01) WHERE a in (SELECT b from t2);
+DELETE FROM t1 WHERE a=a+sleep(.01) ORDER BY a LIMIT 2;
+
+SELECT rows_examined,sql_text FROM mysql.slow_log;
+disconnect con2;
+connection default;
+DROP TABLE t1,t2;
+TRUNCATE TABLE mysql.slow_log;
+
+--echo # end of bug#49756
+
+
--echo End of 5.1 tests
@@ -361,6 +397,8 @@ disconnect con1;
connection default;
# Reset global system variables to initial values if forgotten somewhere above.
+SET GLOBAL long_query_time = DEFAULT;
+SET GLOBAL log_output = @old_log_output;
SET global general_log = @old_general_log;
SET global general_log_file = @old_general_log_file;
SET global slow_query_log = @old_slow_query_log;
diff --git a/mysql-test/t/mysqlbinlog.test b/mysql-test/t/mysqlbinlog.test
index 5cfd7f9008a..8b250dbb586 100644
--- a/mysql-test/t/mysqlbinlog.test
+++ b/mysql-test/t/mysqlbinlog.test
@@ -445,12 +445,19 @@ FLUSH LOGS;
# Transaction3 end
--echo #
---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is exist
+--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified exists
--exec $MYSQL_BINLOG --database=test --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
--echo #
---echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified is not exist
+--echo # Test if the 'BEGIN', 'ROLLBACK' and 'COMMIT' are output if the database specified does not exist
--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_transaction.000001
+--echo #
+--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified exists
+--exec $MYSQL_BINLOG --database=db1 --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
+--echo #
+--echo # Test if the 'SAVEPOINT', 'ROLLBACK TO' are output if the database specified does not exist
+--exec $MYSQL_BINLOG --database=not_exist --short-form $MYSQLTEST_VARDIR/std_data/binlog_savepoint.000001
+
--echo End of 5.0 tests
--echo End of 5.1 tests
diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test
index a260f13e58b..952a3f94fb2 100644
--- a/mysql-test/t/mysqldump.test
+++ b/mysql-test/t/mysqldump.test
@@ -1988,6 +1988,7 @@ drop table if exists `load`;
create table `load` (a varchar(255));
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/tmp/load.txt
+--chmod 0644 $MYSQLTEST_VARDIR/tmp/load.txt
--exec $MYSQL_IMPORT --ignore test $MYSQLTEST_VARDIR/tmp/load.txt
@@ -2137,6 +2138,35 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
+###########################################################################
+
+--echo #
+--echo # Bug #53088: mysqldump with -T & --default-character-set set
+--echo # truncates text/blob to 766 chars
+--echo #
+--echo # Also see outfile_loaddata.test
+--echo #
+
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+
+let $table= t1;
+let $dir= $MYSQLTEST_VARDIR/tmp;
+let $file= $dir/$table.txt;
+let $length= 800;
+
+--eval INSERT INTO t1 VALUES (REPEAT('.', $length))
+
+--exec $MYSQL_DUMP --character-sets-dir=$CHARSETSDIR --default-character-set=latin1 --tab=$dir/ test $table
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+
+--eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET latin1
+--remove_file $file
+
+--echo # should be $length
+SELECT LENGTH(a) FROM t2;
+
+DROP TABLE t1, t2;
###########################################################################
--echo #
diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test
index 3f62acbd214..26760f9a1b2 100644
--- a/mysql-test/t/outfile_loaddata.test
+++ b/mysql-test/t/outfile_loaddata.test
@@ -251,6 +251,40 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c;
SET NAMES default;
DROP TABLE t1, t2;
+###########################################################################
+
+--echo #
+--echo # Bug #53088: mysqldump with -T & --default-character-set set
+--echo # truncates text/blob to 766 chars
+--echo #
+--echo # Also see mysqldump.test
+--echo #
+
+CREATE TABLE t1 (a BLOB) CHARSET latin1;
+CREATE TABLE t2 LIKE t1;
+
+let $file= '$MYSQLTEST_VARDIR/tmp/bug53088.txt';
+let $length= 800;
+
+--eval INSERT INTO t1 VALUES (REPEAT('.', $length))
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1
+
+--echo # should be greater than $length
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LENGTH(LOAD_FILE($file))
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE $file INTO TABLE t2
+
+--remove_file $MYSQLTEST_VARDIR/tmp/bug53088.txt
+
+--echo # should be $length
+SELECT LENGTH(a) FROM t2;
+
+DROP TABLE t1, t2;
+
###########################################################################
--echo # End of 5.1 tests.
diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test
index bcb5d4b5d92..1224dee24ed 100644
--- a/mysql-test/t/partition.test
+++ b/mysql-test/t/partition.test
@@ -2185,4 +2185,16 @@ SELECT * FROM t1;
DROP TABLE t1;
+--echo #
+--echo # BUG#51868 - crash with myisam_use_mmap and partitioned myisam tables
+--echo #
+SET GLOBAL myisam_use_mmap=1;
+CREATE TABLE t1(a INT) PARTITION BY HASH(a) PARTITIONS 1;
+INSERT INTO t1 VALUES(0);
+FLUSH TABLE t1;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(0);
+DROP TABLE t1;
+SET GLOBAL myisam_use_mmap=default;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test
index dcea4d9828b..f7ce70c1d3a 100644
--- a/mysql-test/t/ps.test
+++ b/mysql-test/t/ps.test
@@ -3065,6 +3065,20 @@ select @plaintext;
deallocate prepare encode;
deallocate prepare decode;
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
+ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
+--disable_warnings
+EXECUTE stmt;
+EXECUTE stmt;
+--enable_warnings
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
###########################################################################
--echo
diff --git a/mysql-test/t/query_cache_with_views.test b/mysql-test/t/query_cache_with_views.test
index d4ebe45b7ac..97e37c53aa3 100644
--- a/mysql-test/t/query_cache_with_views.test
+++ b/mysql-test/t/query_cache_with_views.test
@@ -126,5 +126,22 @@ show status like "Qcache_inserts";
show status like "Qcache_hits";
drop table t1;
+--echo #
+--echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table
+--echo #
+CREATE TABLE t1 (c1 INT, c2 INT);
+CREATE TABLE t2 LIKE t1;
+SET AUTOCOMMIT=OFF;
+CREATE VIEW t1_view AS SELECT c1 FROM t1 NATURAL JOIN t2 ;
+# Before the bug patch the below INSERT stmt used to
+# crash when other fields than the ones listed in the
+# view definition were used.
+--error ER_BAD_FIELD_ERROR
+INSERT INTO t1_view (c1, c2) SELECT c1, c2 FROM t1;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP VIEW t1_view;
+SET AUTOCOMMIT=DEFAULT;
+
# Reset default environment.
set GLOBAL query_cache_size=default;
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 5d5ad180f1a..2d2a6f75d73 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -1313,4 +1313,45 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY)
DROP TABLE t1;
+--echo #
+--echo # Bug#50939: Loose Index Scan unduly relies on engine to remember range
+--echo # endpoints
+--echo #
+CREATE TABLE t1 (
+ a INT,
+ b INT,
+ KEY ( a, b )
+) PARTITION BY HASH (a) PARTITIONS 1;
+
+CREATE TABLE t2 (
+ a INT,
+ b INT,
+ KEY ( a, b )
+);
+
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+
+INSERT INTO t1 SELECT a + 5, b + 5 FROM t1;
+INSERT INTO t1 SELECT a + 10, b + 10 FROM t1;
+INSERT INTO t1 SELECT a + 20, b + 20 FROM t1;
+INSERT INTO t1 SELECT a + 40, b + 40 FROM t1;
+
+INSERT INTO t2 SELECT * FROM t1;
+
+--echo # plans should be identical
+EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a;
+EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a;
+
+FLUSH status;
+SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a;
+--echo # Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+
+FLUSH status;
+SELECT a, MAX(b) FROM t2 WHERE a IN (10, 100) GROUP BY a;
+--echo # Should be no more than 4 reads.
+SHOW status LIKE 'handler_read_key';
+
+DROP TABLE t1, t2;
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test
index 84315090b7a..71d0c127058 100644
--- a/mysql-test/t/renamedb.test
+++ b/mysql-test/t/renamedb.test
@@ -44,7 +44,7 @@ ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME;
--error ER_WRONG_USAGE
ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME;
---error ER_WRONG_USAGE
+--error ER_WRONG_DB_NAME
ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME;
--error ER_BAD_DB_ERROR
diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test
index fcc4259168b..cec44078279 100644
--- a/mysql-test/t/row.test
+++ b/mysql-test/t/row.test
@@ -255,3 +255,14 @@ select * from t1,t2 where (a,b) = (c,d);
select host,user from mysql.user where (host,user) = ('localhost','test');
drop table t1,t2;
+
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+--disable_warnings
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+--enable_warnings
+DROP TABLE t1;
diff --git a/mysql-test/t/skip_name_resolve.test b/mysql-test/t/skip_name_resolve.test
index cd7ffe1690d..a14f3af5cd6 100644
--- a/mysql-test/t/skip_name_resolve.test
+++ b/mysql-test/t/skip_name_resolve.test
@@ -29,3 +29,24 @@ disconnect con1;
# Wait till all disconnects are completed
--source include/wait_until_count_sessions.inc
+--echo #
+--echo # Bug #37168: Missing variable - skip_name_resolve
+--echo #
+
+SHOW VARIABLES LIKE 'skip_name_resolve';
+SHOW GLOBAL VARIABLES LIKE 'skip_name_resolve';
+SHOW SESSION VARIABLES LIKE 'skip_name_resolve';
+
+SELECT @@skip_name_resolve;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@LOCAL.skip_name_resolve;
+SELECT @@GLOBAL.skip_name_resolve;
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@skip_name_resolve=0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@LOCAL.skip_name_resolve=0;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.skip_name_resolve=0;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 50f2644ff9e..06aaf5dfb7f 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3838,3 +3838,86 @@ DROP TABLE t1;
--echo End of 5.1 tests.
+
+#
+# Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN on index
+#
+
+--echo Set up test tables.
+CREATE TABLE t1 (
+ t1_id INT UNSIGNED,
+
+ PRIMARY KEY(t1_id)
+) Engine=MyISAM;
+
+INSERT INTO t1 (t1_id) VALUES (1), (2), (3), (4), (5);
+
+CREATE TABLE t2 SELECT * FROM t1;
+
+CREATE TABLE t3 (
+ t3_id INT UNSIGNED AUTO_INCREMENT,
+ t1_id INT UNSIGNED,
+ amount DECIMAL(16,2),
+
+ PRIMARY KEY(t3_id),
+ KEY(t1_id)
+) Engine=MyISAM;
+
+INSERT INTO t3 (t1_id, t3_id, amount)
+ VALUES (1, 1, 100.00), (2, 2, 200.00), (4, 4, 400.00);
+
+--echo This is the 'inner query' running by itself.
+--echo Produces correct results.
+SELECT
+ t1.t1_id,
+ IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+ t1
+ LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+ t1.t1_id
+;
+
+--echo SELECT * FROM (the same inner query)
+--echo Produces correct results.
+SELECT * FROM (
+SELECT
+ t1.t1_id,
+ IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+ t1
+ LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+ t1.t1_id
+) AS t;
+
+--echo Now make t2.t1_id part of a key.
+ALTER TABLE t2 ADD PRIMARY KEY(t1_id);
+
+--echo Same inner query by itself.
+--echo Still correct results.
+SELECT
+ t1.t1_id,
+ IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+ t1
+ LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+ t1.t1_id;
+
+--echo SELECT * FROM (the same inner query), now with indexes on the LEFT JOIN
+SELECT * FROM (
+SELECT
+ t1.t1_id,
+ IFNULL((SELECT SUM(amount) FROM t3 WHERE t3.t1_id=t1.t1_id), 0) AS total_amount
+FROM
+ t1
+ LEFT JOIN t2 ON t2.t1_id=t1.t1_id
+GROUP BY
+ t1.t1_id
+) AS t;
+
+
+DROP TABLE t3;
+DROP TABLE t2;
+DROP TABLE t1;
diff --git a/mysql-test/t/symlink.test b/mysql-test/t/symlink.test
index c805dd40fe8..073fcd28246 100644
--- a/mysql-test/t/symlink.test
+++ b/mysql-test/t/symlink.test
@@ -249,4 +249,26 @@ eval CREATE TABLE t1(a INT) DATA DIRECTORY='$MYSQLTEST_VARDIR/tmp' INDEX DIRECTO
DROP TABLE t1;
SET @@SQL_MODE=@OLD_SQL_MODE;
+--echo #
+--echo # BUG#40980 - Drop table can remove another MyISAM table's
+--echo # data and index files
+--echo #
+--mkdir $MYSQL_TMP_DIR/mysql
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval CREATE TABLE user(a INT) DATA DIRECTORY='$MYSQL_TMP_DIR/mysql'
+ INDEX DIRECTORY='$MYSQL_TMP_DIR/mysql';
+FLUSH TABLE user;
+--echo # Symlinking mysql database to tmpdir
+--remove_file $MYSQL_TMP_DIR/mysql/user.MYD
+--remove_file $MYSQL_TMP_DIR/mysql/user.MYI
+--rmdir $MYSQL_TMP_DIR/mysql
+--exec ln -s $MYSQLD_DATADIR/mysql $MYSQL_TMP_DIR/mysql
+FLUSH TABLE mysql.user;
+DROP TABLE user;
+FLUSH TABLE mysql.user;
+--disable_result_log
+SELECT * FROM mysql.user;
+--enable_result_log
+--remove_file $MYSQL_TMP_DIR/mysql
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
index 8ba21ed696a..2eb086cace5 100644
--- a/mysql-test/t/trigger.test
+++ b/mysql-test/t/trigger.test
@@ -2426,6 +2426,50 @@ INSERT IGNORE INTO t2 SET a = '777';
DROP TRIGGER trg1;
DROP TABLE t1, t2;
+#
+# Bug #48525: trigger changes "Column 'id' cannot be null" behaviour
+#
+CREATE TABLE t1 (id INT NOT NULL);
+CREATE TABLE t2 (id INT NOT NULL);
+INSERT t1 VALUES (1),(2),(3);
+UPDATE t1 SET id=NULL;
+CREATE TRIGGER t1_bu BEFORE UPDATE ON t1 FOR EACH ROW
+ INSERT INTO t2 VALUES (3);
+UPDATE t1 SET id=NULL;
+DROP TRIGGER t1_bu;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#50755: Crash if stored routine def contains version comments
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP TRIGGER IF EXISTS trg1;
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+CREATE DATABASE db1;
+USE db1;
+
+CREATE TABLE t1 (b INT);
+CREATE TABLE t2 (a INT);
+
+CREATE TRIGGER trg1 BEFORE INSERT ON t2 FOR EACH ROW INSERT/*!INTO*/t1 VALUES (1);
+--echo # Used to crash
+SHOW TRIGGERS IN db1;
+--error ER_PARSE_ERROR
+INSERT INTO t2 VALUES (1);
+SELECT * FROM t1;
+
+--echo # Work around Bug#45235
+let $MYSQLD_DATADIR = `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/db1/t2.TRG
+--remove_file $MYSQLD_DATADIR/db1/trg1.TRN
+
+DROP DATABASE db1;
+USE test;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test
index e390e8a1253..a7b9a1531ff 100644
--- a/mysql-test/t/upgrade.test
+++ b/mysql-test/t/upgrade.test
@@ -137,3 +137,37 @@ select * from `a-b-c`.v1;
--enable_ps_protocol
drop database `a-b-c`;
use test;
+
+--echo # End of 5.0 tests
+
+--echo #
+--echo # Bug #53804: serious flaws in the alter database .. upgrade data
+--echo # directory name command
+--echo #
+
+--error ER_BAD_DB_ERROR
+ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME;
+--error ER_WRONG_DB_NAME
+ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME;
+
+--error ER_WRONG_DB_NAME
+USE `#mysql50#.`;
+--error ER_WRONG_DB_NAME
+USE `#mysql50#../blablabla`;
+
+--echo # End of 5.1 tests
+
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 39fa78ef370..5e9d8473b20 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1220,6 +1220,14 @@ SET @old_max_binlog_cache_size = @@GLOBAL.max_binlog_cache_size;
SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024;
SELECT @@GLOBAL.max_binlog_cache_size;
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
+
+--echo #
+--echo # Bug #37168 : Missing variable - skip_name_resolve
+--echo #
+
+SELECT @@skip_name_resolve;
+SHOW VARIABLES LIKE 'skip_name_resolve';
+
--echo End of 5.1 tests
###########################################################################
diff --git a/mysql-test/t/variables_debug.test b/mysql-test/t/variables_debug.test
index dac85345136..8fa2124137a 100644
--- a/mysql-test/t/variables_debug.test
+++ b/mysql-test/t/variables_debug.test
@@ -1,5 +1,7 @@
--source include/have_debug.inc
+SET @old_debug = @@GLOBAL.debug;
+
#
# Bug#34678 @@debug variable's incremental mode
#
@@ -20,3 +22,17 @@ SELECT @@session.debug, @@global.debug;
SET SESSION debug = '';
SELECT @@session.debug, @@global.debug;
+
+--echo #
+--echo # Bug #52629: memory leak from sys_var_thd_dbug in
+--echo # binlog.binlog_write_error
+--echo #
+
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+SET GLOBAL debug='';
+SELECT @@global.debug;
+
+SET GLOBAL debug=@old_debug;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index d1a4d78e58f..4ef8b1898ae 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -3953,6 +3953,15 @@ ROW(1,1) >= ROW(1, (SELECT 1 FROM t1 WHERE f1 >= ANY ( SELECT '1' )));
DROP VIEW v1;
DROP TABLE t1;
+--echo #
+--echo # Bug#52120 create view cause Assertion failed: 0, file .\item_subselect.cc, line 817
+--echo #
+CREATE TABLE t1 (a CHAR(1) CHARSET latin1, b CHAR(1) CHARSET utf8);
+CREATE VIEW v1 AS SELECT 1 from t1
+WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
+DROP VIEW v1;
+DROP TABLE t1;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.1 tests.
--echo # -----------------------------------------------------------------