summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-17 21:24:29 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-17 21:24:29 +0200
commit97e640b9ae83e07b444fceede6b0524256c7a3cc (patch)
tree8f48fbfaf88ea7895ce59fd3ac2fbe6184334387 /mysql-test/t
parent2f6a2494a5eb2cf3ab06fbedd2584eca85d90230 (diff)
parentc7973615e723b13c6457b494b72be2fac35bfd18 (diff)
downloadmariadb-git-97e640b9ae83e07b444fceede6b0524256c7a3cc.tar.gz
5.5 merge
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/cast.test3
-rw-r--r--mysql-test/t/fulltext_derived_4257.test6
-rw-r--r--mysql-test/t/func_time.test8
-rw-r--r--mysql-test/t/grant_4332.test22
-rw-r--r--mysql-test/t/group_min_max.test47
-rw-r--r--mysql-test/t/index_merge_myisam.test27
-rw-r--r--mysql-test/t/join.test7
-rw-r--r--mysql-test/t/mrr_derived_crash_4610.test16
-rw-r--r--mysql-test/t/mysql_binary_mode.test169
-rw-r--r--mysql-test/t/mysql_upgrade.test4
-rw-r--r--mysql-test/t/plugin.test21
-rw-r--r--mysql-test/t/processlist.test35
-rw-r--r--mysql-test/t/sp_missing_4665.test9
-rw-r--r--mysql-test/t/strict.test10
-rw-r--r--mysql-test/t/subselect_innodb.test41
-rw-r--r--mysql-test/t/subselect_sj.test38
-rw-r--r--mysql-test/t/subselect_sj2.test29
-rw-r--r--mysql-test/t/type_date.test9
-rw-r--r--mysql-test/t/type_datetime.test5
-rw-r--r--mysql-test/t/type_datetime_hires.test9
-rw-r--r--mysql-test/t/type_time.test9
-rw-r--r--mysql-test/t/variables.test3
-rw-r--r--mysql-test/t/view.test14
23 files changed, 535 insertions, 6 deletions
diff --git a/mysql-test/t/cast.test b/mysql-test/t/cast.test
index 64e8225530b..b7630348c93 100644
--- a/mysql-test/t/cast.test
+++ b/mysql-test/t/cast.test
@@ -450,3 +450,6 @@ drop table t1;
#
SELECT CAST(TIME('10:20:30') AS DATE) + INTERVAL 1 DAY;
+SET SQL_MODE=ALLOW_INVALID_DATES;
+SELECT DATE("foo");
+
diff --git a/mysql-test/t/fulltext_derived_4257.test b/mysql-test/t/fulltext_derived_4257.test
new file mode 100644
index 00000000000..07626b8b557
--- /dev/null
+++ b/mysql-test/t/fulltext_derived_4257.test
@@ -0,0 +1,6 @@
+set optimizer_switch = 'derived_merge=on';
+create table t1 (c1 char(8), c2 char(8)) engine=myisam;
+insert into t1 values ('test1','test2'),('test3','test4');
+select * from (select c1 from t1 where match (c2) against ('hello' in boolean mode)) as alias;
+drop table t1;
+
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index 7a72c21d0ff..6f9359e6095 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1186,3 +1186,11 @@ SELECT 1 FROM DUAL WHERE DAYOFMONTH(TIMEDIFF(NULL, '12:12:12'));
SELECT 1 FROM DUAL WHERE HOUR(TIMEDIFF(NULL, '12:12:12'));
SELECT 1 FROM DUAL WHERE MINUTE(TIMEDIFF(NULL, '12:12:12'));
SELECT 1 FROM DUAL WHERE SECOND(TIMEDIFF(NULL, '12:12:12'));
+
+
+--echo #
+--echo # MDEV-4635 Crash in UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'))
+--echo #
+SET TIME_ZONE='+02:00';
+SELECT UNIX_TIMESTAMP(STR_TO_DATE('2020','%Y'));
+SET TIME_ZONE=DEFAULT;
diff --git a/mysql-test/t/grant_4332.test b/mysql-test/t/grant_4332.test
index f77d3be350f..302624e3873 100644
--- a/mysql-test/t/grant_4332.test
+++ b/mysql-test/t/grant_4332.test
@@ -58,16 +58,38 @@ select user from mysql.tables_priv;
--error ER_COLUMNACCESS_DENIED_ERROR
select user,host from mysql.tables_priv;
+--error ER_DBACCESS_DENIED_ERROR
+use mtr;
+
+--error ER_PROCACCESS_DENIED_ERROR
+drop procedure mtr.add_suppression;
+
create procedure test.p1() select user(), current_user(), user from mysql.tables_priv;
show create procedure test.p1;
+select definer from information_schema.routines;
+
create table test.t1 (a text);
create event e1 on schedule every 1 second
do insert test.t1 values (concat(user(), ' ', current_user()));
+select definer from information_schema.events;
+
+create view v1 as select * from t1;
+select definer from information_schema.views;
+drop view v1;
+
+create trigger tr1 before delete on t1 for each row set @a:=1;
+select definer from information_schema.triggers;
+drop trigger tr1;
+
connection default;
+--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
+--error ER_ACCESS_DENIED_ERROR
+connect (c80bad,localhost,c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0,foobar,);
+
call test.p1();
disconnect a17;
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test
index 82097c53fe0..034da4eb925 100644
--- a/mysql-test/t/group_min_max.test
+++ b/mysql-test/t/group_min_max.test
@@ -1400,3 +1400,50 @@ explain SELECT f1, COUNT(DISTINCT f2) FROM t1 GROUP BY f1;
drop table t1;
--echo # End of test#50539.
+
+--echo #
+--echo # MDEV-4219 A simple select query returns random data (upstream bug#68473)
+--echo #
+
+--disable_warnings
+drop table if exists faulty;
+--enable_warnings
+
+# MySQL's test case
+
+CREATE TABLE faulty (
+a int(11) unsigned NOT NULL AUTO_INCREMENT,
+b int(11) unsigned NOT NULL,
+c datetime NOT NULL,
+PRIMARY KEY (a),
+UNIQUE KEY b_and_c (b,c)
+);
+
+INSERT INTO faulty (b, c) VALUES
+(1801, '2013-02-15 09:00:00'),
+(1802, '2013-02-28 09:00:00'),
+(1802, '2013-03-01 09:00:00'),
+(5, '1990-02-15 09:00:00'),
+(5, '2013-02-15 09:00:00'),
+(5, '2009-02-15 17:00:00');
+
+EXPLAIN
+SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c;
+SELECT DISTINCT b, c FROM faulty WHERE b='1802' ORDER BY c;
+
+drop table faulty;
+
+# MariaDB test case
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3);
+INSERT INTO t1 SELECT a + 1, b FROM t1;
+INSERT INTO t1 SELECT a + 2, b FROM t1;
+
+CREATE INDEX break_it ON t1 (a, b);
+
+EXPLAIN
+SELECT distinct a, b FROM t1 where a = '3' ORDER BY b;
+SELECT distinct a, b FROM t1 where a = '3' ORDER BY b;
+
+drop table t1;
diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test
index 614c6595d61..07f83fa6713 100644
--- a/mysql-test/t/index_merge_myisam.test
+++ b/mysql-test/t/index_merge_myisam.test
@@ -149,5 +149,32 @@ GROUP BY 2;
DROP TABLE t1,t2,t3;
+--echo #
+--echo # MDEV-4556 Server crashes in SEL_ARG::rb_insert with index_merge+index_merge_sort_union, FORCE INDEX
+--echo #
+CREATE TABLE t1 (
+ pk int,
+ code char(2),
+ population_rate int,
+ area_rate int,
+ primary key (pk),
+ index (code),
+ key (population_rate),
+ key (area_rate)
+);
+
+INSERT INTO t1 VALUES (1,'WI',20, 23), (2, 'WA', 13, 18);
+
+EXPLAIN
+SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code )
+WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL )
+AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX');
+
+SELECT * FROM t1 FORCE INDEX ( PRIMARY, population_rate, area_rate, code )
+WHERE pk = 1 OR population_rate = 1 OR ( area_rate IN ( 1,2 ) OR area_rate IS NULL )
+AND (population_rate = 25 OR area_rate BETWEEN 2 AND 25 OR code BETWEEN 'MA' AND 'TX');
+
+DROP TABLE t1;
+
set optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/t/join.test b/mysql-test/t/join.test
index 33289f77c13..73b40715676 100644
--- a/mysql-test/t/join.test
+++ b/mysql-test/t/join.test
@@ -1135,6 +1135,13 @@ SET optimizer_switch=@tmp_optimizer_switch;
DROP TABLE t1,t2,t3,t4,t5;
+--echo #
+--echo # MDEV-4752: Segfault during parsing of illegal query
+--echo #
+--error ER_PARSE_ERROR
+SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
+
+
SET optimizer_switch=@save_optimizer_switch;
--echo #
diff --git a/mysql-test/t/mrr_derived_crash_4610.test b/mysql-test/t/mrr_derived_crash_4610.test
new file mode 100644
index 00000000000..88882b57cf7
--- /dev/null
+++ b/mysql-test/t/mrr_derived_crash_4610.test
@@ -0,0 +1,16 @@
+#
+# MDEV-4610 SQL query crashes MariaDB with derived_with_keys
+#
+--source include/have_innodb.inc
+create table t1 (f1 char(4) primary key) engine=innodb charset=utf8 ;
+insert into t1 values ('aaaa');
+create table t2 (f2 text, f3 char(4) not null) engine=innodb charset=utf8 ;
+create table t3 (id int not null) engine=innodb charset=utf8 ;
+create table t4 (val int not null) engine=innodb charset=utf8;
+explain select 1 from
+ (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top
+ join t1 on f1 = f3 where f3 = 'aaaa' order by val;
+select 1 from
+ (select f2, f3, val, count(id) from t4 join t2 left join t3 on 0) top
+ join t1 on f1 = f3 where f3 = 'aaaa' order by val;
+drop table t1, t2, t3, t4;
diff --git a/mysql-test/t/mysql_binary_mode.test b/mysql-test/t/mysql_binary_mode.test
new file mode 100644
index 00000000000..d454bfb7624
--- /dev/null
+++ b/mysql-test/t/mysql_binary_mode.test
@@ -0,0 +1,169 @@
+source include/have_binlog_format_mixed_or_statement.inc;
+RESET MASTER;
+
+--echo # Bug#33048 Not able to recover binary/blob data correctly using mysqlbinlog
+--echo # --------------------------------------------------------------------------
+--echo # The test verify that 0x00 and 0x0D0A sequence can be handled correctly by
+--echo # mysql
+--echo
+
+# zero => 0x00, newline => 0x0D0A, A => 0x41, B => 0x42
+
+# 0x410D0A42 => 'A\r\nB'
+let $table_name_right= `SELECT 0x410D0A42`;
+
+# 0x410A42 => 'A\nB'
+let $table_name_wrong= `SELECT 0x410A42`;
+
+# 0x410042 => 'A\0B'
+let $char0= `SELECT 0x410042`;
+
+eval CREATE TABLE `$table_name_right` (c1 CHAR(100));
+
+--echo # It is a faked statement. ASCII 0 is in the original statement, it would
+--echo # make the test result to become a binary file which was difficult to get
+--echo # the diff result if the original query was logged in the result.
+--echo INSERT INTO `A\r\nB` VALUES("A\0B");
+--echo
+--disable_query_log
+eval INSERT INTO `$table_name_right` VALUES("$char0");
+--enable_query_log
+
+let $char0= $table_name_right;
+eval INSERT INTO `$table_name_right` VALUES("$char0");
+
+eval SELECT HEX(c1) FROM `$table_name_right`;
+
+--echo
+let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1);
+FLUSH LOGS;
+eval DROP TABLE `$table_name_right`;
+
+--echo
+let $MYSQLD_DATADIR= `SELECT @@datadir`;
+--exec $MYSQL_BINLOG $MYSQLD_DATADIR/$binlog_file > $MYSQLTEST_VARDIR/tmp/my.sql
+RESET MASTER;
+
+--echo # '--exec mysql ...' without --binary-mode option
+--echo # It creates the table with a wrong table name and generates an error.
+--echo # (error output was suppressed to make the test case platform agnostic)
+
+## disabling result log because the error message has the
+## table name in the output which is one byte different ('\r')
+## on unixes and windows.
+--disable_result_log
+--error 1
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/my.sql 2>&1
+--enable_result_log
+
+--echo
+--echo # It is not in binary_mode, so table name '0x410D0A42' can be translated to
+--echo # '0x410A42' by mysql depending on the OS - Windows or Unix-like.
+--replace_result $table_name_wrong TABLE_NAME_MASKED $table_name_right TABLE_NAME_MASKED
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
+{
+ eval DROP TABLE `$table_name_right`;
+}
+
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
+{
+ eval DROP TABLE `$table_name_wrong`;
+}
+
+--echo
+--echo # In binary_mode, table name '0x410D0A42' and string '0x410042' can be
+--echo # handled correctly.
+RESET MASTER;
+--exec $MYSQL --binary-mode test < $MYSQLTEST_VARDIR/tmp/my.sql
+eval SELECT HEX(c1) FROM `$table_name_right`;
+
+--echo
+eval DROP TABLE `$table_name_right`;
+
+#
+# BUG#12794048 - MAIN.MYSQL_BINARY_MODE FAILS ON WINDOWS RELEASE BUILD
+#
+RESET MASTER;
+
+#
+# This test case tests if the table names and their values
+# are handled properly. For that we check
+#
+
+# 0x610D0A62 => 'a\r\nb'
+let $tbl= `SELECT 0x610D0A62`;
+
+--disable_result_log
+--disable_query_log
+
+--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+
+#### case #1: mysqltest
+#### CREATE table and insert value through regular mysqltest session
+
+--eval CREATE TABLE `$tbl` (c1 CHAR(100))
+--eval INSERT INTO `$tbl` VALUES ("$tbl")
+
+--let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
+--let $tbl0= `SELECT HEX(table_name) FROM information_schema.tables WHERE table_schema='test'`
+--let $val0= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
+
+FLUSH LOGS;
+
+--eval DROP TABLE `$table_name`;
+
+#### case #2: mysql --binlog-mode=0
+#### Replay through regular mysql client non-interactive mode
+
+--let $MYSQLD_DATADIR= `SELECT @@datadir`
+--let $prefix=`SELECT UUID()`
+--let $binlog_uuid_filename= $MYSQLTEST_VARDIR/tmp/$prefix-bin.log
+--copy_file $MYSQLD_DATADIR/$binlog_file $binlog_uuid_filename
+RESET MASTER;
+
+--exec $MYSQL_BINLOG $binlog_uuid_filename | $MYSQL
+
+--let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
+--let $tbl1= `SELECT hex(table_name) FROM information_schema.tables WHERE table_schema='test'`
+--let $val1= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
+
+--eval DROP TABLE `$table_name`;
+
+#### case #3: mysql --binlog-mode=1
+#### Replay through regular mysql client non-interactive mode and with binary mode set
+
+RESET MASTER;
+--exec $MYSQL_BINLOG $binlog_uuid_filename | $MYSQL --binary-mode
+
+--let $table_name=`SELECT table_name FROM information_schema.tables WHERE table_schema='test'`
+--let $tbl2= `SELECT hex(table_name) FROM information_schema.tables WHERE table_schema='test'`
+--let $val2= `SELECT HEX(c1) FROM `$table_name` LIMIT 1`
+
+--eval DROP TABLE `$table_name`;
+
+--enable_result_log
+--disable_query_log
+
+##### OUTCOME
+
+--let $assert_text= Table and contents created through mysqltest match 0x610D0A62.
+--let $assert_cond= "$tbl0" = "610D0A62" AND "$val0" = "610D0A62"
+--source include/assert.inc
+
+--let $assert_text= Table and contents created while replaying binary log without --binary-mode set match 0x61(0D)0A62.
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) IN ('Win32', 'Win64', 'Windows')`)
+{
+ --let $assert_cond= "$tbl1" = "610D0A62" AND "$val1" = "610D0A62"
+}
+if (`SELECT CONVERT(@@VERSION_COMPILE_OS USING latin1) NOT IN ('Win32', 'Win64', 'Windows')`)
+{
+ --let $assert_cond= "$tbl1" = "610A62" AND "$val1" = "610A62"
+}
+--source include/assert.inc
+
+--let $assert_text= Table and contents created while replaying binary log with --binary-mode set match 0x610D0A62.
+--let $assert_cond= "$tbl2" = "610D0A62" AND "$val2" = "610D0A62"
+--source include/assert.inc
+
+RESET MASTER;
+--remove_file $binlog_uuid_filename
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 78d439d5d52..2018861b2da 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -49,7 +49,9 @@ DROP USER mysqltest1@'%';
--replace_result $MYSQLTEST_VARDIR var
--replace_regex /.*mysqlcheck.*: Got/mysqlcheck: Got/ /\([0-9|-]*\)/(errno)/
--error 1
---exec $MYSQL_UPGRADE --force --host=not_existing_host 2>&1
+# NC: Added --skip-version-check, as the version check would fail when
+# mysql_upgrade tries to get the server version.
+--exec $MYSQL_UPGRADE --verbose --force --host=not_existing_host --skip-version-check 2>&1
#
# Bug #28401 mysql_upgrade Failed with STRICT_ALL_TABLES, ANSI_QUOTES and NO_ZERO_DATE
diff --git a/mysql-test/t/plugin.test b/mysql-test/t/plugin.test
index 602b2e3c5c9..94030670d9f 100644
--- a/mysql-test/t/plugin.test
+++ b/mysql-test/t/plugin.test
@@ -174,3 +174,24 @@ SET @@SQL_MODE=@OLD_SQL_MODE;
#
select 1;
UNINSTALL PLUGIN example;
+
+#
+# MDEV-4573 UNINSTALL PLUGIN misleading error message for non-dynamic plugins
+#
+--error ER_PLUGIN_DELETE_BUILTIN
+UNINSTALL PLUGIN MyISAM;
+
+#
+# MDEV-4529 Assertion `tmp->state == 4' fails on mix of INSTALL SONAME / UNINSTALL PLUGIN
+#
+
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+install soname 'ha_example';
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+uninstall plugin example;
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+install soname 'ha_example';
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+uninstall soname 'ha_example';
+select plugin_name from information_schema.plugins where plugin_library like 'ha_example%';
+
diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test
new file mode 100644
index 00000000000..c7b775cf992
--- /dev/null
+++ b/mysql-test/t/processlist.test
@@ -0,0 +1,35 @@
+#
+# MDEV-4578 information_schema.processlist reports incorrect value for Time (2147483647)
+#
+
+source include/have_debug_sync.inc;
+
+SET DEBUG_SYNC = 'dispatch_command_before_set_time WAIT_FOR do_set_time';
+send SELECT 1;
+
+connect (con1,localhost,root,,);
+
+SET DEBUG_SYNC = 'fill_schema_processlist_after_unow SIGNAL do_set_time WAIT_FOR fill_schema_proceed';
+send SELECT INFO,TIME,TIME_MS FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO IS NULL;
+
+connection default;
+reap;
+SET DEBUG_SYNC = 'now SIGNAL fill_schema_proceed';
+
+connection con1;
+reap;
+connection default;
+
+#
+# MDEV-4683 query start_time not reset when going to sleep
+#
+
+connection con1;
+select sleep(5); #run a query that will take some time
+connection default;
+
+# verify that the time in COM_SLEEP doesn't include the query run time
+select command, time < 5 from information_schema.processlist where id != connection_id();
+
+disconnect con1;
+
diff --git a/mysql-test/t/sp_missing_4665.test b/mysql-test/t/sp_missing_4665.test
new file mode 100644
index 00000000000..19e845e58c7
--- /dev/null
+++ b/mysql-test/t/sp_missing_4665.test
@@ -0,0 +1,9 @@
+#
+# MDEV-4665 crash when referencing missing function in a subquery
+#
+create table t (a int);
+create or replace view v as select 1 from t where a;
+--error ER_SP_DOES_NOT_EXIST
+delete from v where (select g());
+drop view v;
+drop table t;
diff --git a/mysql-test/t/strict.test b/mysql-test/t/strict.test
index f6080de6c2c..c429e9cfe5b 100644
--- a/mysql-test/t/strict.test
+++ b/mysql-test/t/strict.test
@@ -188,13 +188,15 @@ INSERT INTO t1 (col1) VALUES (STR_TO_DATE('15.10.2004','%d.%m.%Y'));
INSERT INTO t1 (col2) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
INSERT INTO t1 (col3) VALUES (STR_TO_DATE('15.10.2004 10.15','%d.%m.%Y %H.%i'));
+# Zero year is not a problem for DATE/DATETIME
+INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
+
## Test INSERT with STR_TO_DATE into DATE
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid date value>
--error 1411
-INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
---error 1411
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
--error 1411
INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -214,8 +216,6 @@ INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# SQLSTATE 22007 <invalid datetime value>
--error 1411
-INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
---error 1411
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
--error 1411
INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i'));
@@ -234,7 +234,7 @@ INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y'));
# All test cases expected to fail should return
# SQLSTATE 22007 <invalid datetime value>
---error 1411
+--error 1292
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i'));
--error 1411
INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i'));
diff --git a/mysql-test/t/subselect_innodb.test b/mysql-test/t/subselect_innodb.test
index fc07a088a15..bd4f3a3c2d8 100644
--- a/mysql-test/t/subselect_innodb.test
+++ b/mysql-test/t/subselect_innodb.test
@@ -439,4 +439,45 @@ select distinct (1 + (select 1 from `t2` where `a`)) `d2` from `t1`;
drop table t1,t2;
+--echo #
+--echo # MDEV-4042: Assertion `table->key_read == 0' fails in close_thread_table on EXPLAIN with GROUP BY and HAVING in EXISTS SQ,
+--echo # MDEV-4536: ...sql/sql_base.cc:1598: bool close_thread_table(THD*, TABLE**): Assertion `table->key_read == 0' failed.
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT PRIMARY KEY, c INT) ENGINE=InnoDB;
+CREATE TABLE t3 (d INT) ENGINE=InnoDB;
+
+EXPLAIN
+SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
+SELECT * FROM t1 WHERE EXISTS ( SELECT b FROM t2, t3 GROUP BY b HAVING b != 3 );
+
+DROP TABLE t1,t2,t3;
+
+CREATE TABLE t1 (
+ pk int auto_increment primary key,
+ col_int_key int(11),
+ key col_int_key (col_int_key),col_varchar_key varchar(128),
+ key (col_varchar_key)
+) engine=innodb;
+
+EXPLAIN
+SELECT 1 FROM t1 AS alias1
+WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
+ FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
+ t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
+ )
+ GROUP BY SQ2_field1
+ HAVING SQ2_alias1 . col_int_key >= 7
+ );
+
+SELECT 1 FROM t1 AS alias1
+WHERE EXISTS ( SELECT SQ2_alias1 . col_int_key AS SQ2_field1
+ FROM ( t1 AS SQ2_alias1 RIGHT OUTER JOIN
+ t1 AS SQ2_alias2 ON (SQ2_alias2 . col_int_key = SQ2_alias1 . col_int_key )
+ )
+ GROUP BY SQ2_field1
+ HAVING SQ2_alias1 . col_int_key >= 7
+ );
+drop table t1;
+
+
set optimizer_switch=@subselect_innodb_tmp;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index bfdc6335f1d..cde8d5d0e19 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2584,5 +2584,43 @@ ORDER BY sm;
DROP TABLE t1,t2;
+--echo #
+--echo # mdev-4173 ignored duplicate value when converting heap to temp table
+--echo # could lead to extra rows in semijoin queries or missing row in union queries
+--echo #
+CREATE TABLE t1 (i1 INT) engine=myisam;
+INSERT INTO t1 VALUES
+(4),(8),(0),(0),(0),(7),(7),(5),(3),(4),(9),(6),(1),(5),(6),(2),(4),(4);
+
+CREATE TABLE t2 (i2 INT, j2 INT) engine=myisam;
+INSERT INTO t2 VALUES
+(7,1),(0,7),(9,4),(3,7),(4,0),(2,2),(5,9),(3,4),
+(1,0),(3,9),(5,8),(1,8),(204,18),(224,84),(9,6);
+
+CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam;
+INSERT INTO t3 VALUES
+(0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1);
+
+select @@max_heap_table_size into @tmp_max_heap_table_size;
+select @@join_buffer_size into @tmp_join_buffer_size;
+set max_heap_table_size=16*1024;
+
+--disable_query_log
+let $n = 8;
+while ($n) {
+ eval set join_buffer_size= 128 + 128*$n;
+ SELECT COUNT(*) FROM t1 outer_t1, t2 outer_t2, t3
+ WHERE outer_t1.i1 IN (
+ SELECT j2 FROM t2 LEFT JOIN t3 ON ( i3 = j2 )
+ WHERE i2 <> outer_t2.j2
+ );
+ dec $n;
+}
+--enable_query_log
+
+DROP TABLE t1, t2, t3;
+set join_buffer_size = @tmp_join_buffer_size;
+set max_heap_table_size = @tmp_max_heap_table_size;
+
# The following command must be the last one the file
set optimizer_switch=@subselect_sj_tmp;
diff --git a/mysql-test/t/subselect_sj2.test b/mysql-test/t/subselect_sj2.test
index 92fc500cf55..0f701cf9624 100644
--- a/mysql-test/t/subselect_sj2.test
+++ b/mysql-test/t/subselect_sj2.test
@@ -1225,5 +1225,34 @@ WHERE alias3.d IN (
set optimizer_prune_level=@tmp_951283;
DROP TABLE t1,t2;
+
+--source include/have_innodb.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1,t2,t3,t4;
+--enable_warnings
+
+--echo #
+--echo # MDEV-4782: Valgrind warnings (Conditional jump or move depends on uninitialised value) with InnoDB, semijoin
+--echo #
+CREATE TABLE t1 ( t1_pk1 varchar(3), t1_pk2 varchar(52), PRIMARY KEY (t1_pk1,t1_pk2)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES ('CHN','Chinese'),('USA','English');
+
+CREATE TABLE t2 ( t2_i int(11), t2_c varchar(52)) ENGINE=InnoDB;
+INSERT INTO t2 VALUES (86,'English');
+
+CREATE TABLE t3 ( t3_i int(11), t3_c varchar(35)) ENGINE=InnoDB;
+INSERT INTO t3 VALUES (3989,'Abilene'),(3873,'Akron');
+
+create table t4 like t1;
+insert into t4 select * from t1;
+
+SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' );
+
+explain
+SELECT * FROM t1, t3 WHERE t3_c IN ( SELECT t1_pk2 FROM t4, t2 WHERE t2_c = t1_pk2 AND t2_i >= t3_i ) AND ( t1_pk1 = 'POL' );
+
+DROP TABLE t1,t2,t3,t4;
+
--echo # This must be the last in the file:
set optimizer_switch=@subselect_sj2_tmp;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 3129863ab9b..af8681abff3 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -295,6 +295,15 @@ insert t1 values ('2010-10-10 15:foobar');
drop table t1;
--echo #
+--echo # MDEV-4634 Crash in CONVERT_TZ
+--echo #
+SELECT CONVERT_TZ(GREATEST(DATE('2021-00-00'),DATE('2022-00-00')),'+00:00','+7:5');
+
+--echo #
+--echo # End of 5.3 tests
+--echo #
+
+--echo #
--echo # Bug #33629: last_day function can return null, but has 'not null'
--echo # flag set for result
--echo #
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 05bc72291cd..a1c0509666a 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -486,6 +486,11 @@ select * from t2 left join t1 on t1.a=t2.c where t1.b is null;
drop table t1,t2;
+--echo #
+--echo # MDEV-4634 Crash in CONVERT_TZ
+--echo #
+SELECT CONVERT_TZ(GREATEST(TIMESTAMP('2021-00-00'),TIMESTAMP('2022-00-00')),'+00:00','+7:5');
+
--echo End of 5.3 tests
--echo #
diff --git a/mysql-test/t/type_datetime_hires.test b/mysql-test/t/type_datetime_hires.test
index 74f686d4157..a62c227f563 100644
--- a/mysql-test/t/type_datetime_hires.test
+++ b/mysql-test/t/type_datetime_hires.test
@@ -69,3 +69,12 @@ alter table t1 modify b datetime, modify a datetime(6);
select * from t1;
drop table t1;
+--echo #
+--echo # MDEV-4651 Crash in my_decimal2decimal in a ORDER BY query
+--echo #
+SET @@time_zone='+00:00';
+CREATE TABLE t1 (a DATETIME(4) NOT NULL);
+INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2000-00-00 00:00:00');
+SELECT UNIX_TIMESTAMP(a) FROM t1 ORDER BY 1;
+DROP TABLE t1;
+SET @@time_zone=DEFAULT;
diff --git a/mysql-test/t/type_time.test b/mysql-test/t/type_time.test
index 2ddb6f9dffc..19e0c45fbc0 100644
--- a/mysql-test/t/type_time.test
+++ b/mysql-test/t/type_time.test
@@ -123,6 +123,15 @@ insert into t1 values ('23:38:57');
select f1, f1 = '2010-10-11 23:38:57' from t1;
drop table t1;
+--echo #
+--echo # MDEV-4634 Crash in CONVERT_TZ
+--echo #
+SELECT CONVERT_TZ(GREATEST(TIME('00:00:00'),TIME('00:00:00')),'+00:00','+7:5');
+
+--echo #
+--echo # End of 5.3 tests
+--echo #
+
#
# Bug#42664 - Sign ignored for TIME types when not comparing as longlong
#
diff --git a/mysql-test/t/variables.test b/mysql-test/t/variables.test
index 244c5f039fa..21112cd7130 100644
--- a/mysql-test/t/variables.test
+++ b/mysql-test/t/variables.test
@@ -1212,7 +1212,10 @@ SET GLOBAL server_id = @old_server_id;
SET @old_max_binlog_cache_size = @@GLOBAL.max_binlog_cache_size;
--echo # Set the max_binlog_cache_size to size more than 4GB.
+--disable_warnings
SET GLOBAL max_binlog_cache_size = 5 * 1024 * 1024 * 1024;
+--enable_warnings
+--replace_result 5368709120 max_size 4294963200 max_size
SELECT @@GLOBAL.max_binlog_cache_size;
SET GLOBAL max_binlog_cache_size = @old_max_binlog_cache_size;
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 8b10e53f06d..404780a3368 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4794,6 +4794,20 @@ WHERE a = alias.a );
drop view v1;
drop table t1,t2;
+--echo #
+--echo # MDEV-4593: p_s: crash in simplify_joins with delete using subselect
+--echo # from view
+--echo #
+
+create table `t1`(`a` int);
+create table `t2`(`a` int);
+create or replace view `v1` as select `a` from `t1`;
+prepare s from "delete from `t2` order by (select 1 from `v1`)";
+execute s;
+deallocate prepare s;
+drop view v1;
+drop tables t1,t2;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------