summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2014-02-01 00:54:03 +0100
committerSergei Golubchik <sergii@pisem.net>2014-02-01 00:54:03 +0100
commit59d9d08e2b6f6f35e781d24c47d33d26fb4ba2a5 (patch)
tree3e4a302ccf3912d4d8a40aa271414003bfe7c9b6 /mysql-test/t
parentce02738d7f2f2688eeec7004dd6a30293d36044f (diff)
parent6b6d40fa6ca1fe36f2a51c2723c58dfb3fc025bb (diff)
downloadmariadb-git-59d9d08e2b6f6f35e781d24c47d33d26fb4ba2a5.tar.gz
5.5 merge
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table_trans.test20
-rw-r--r--mysql-test/t/assign_key_cache-5405.test27
-rw-r--r--mysql-test/t/date_formats.test2
-rw-r--r--mysql-test/t/derived.test29
-rw-r--r--mysql-test/t/derived_view.test112
-rw-r--r--mysql-test/t/func_time.test20
-rw-r--r--mysql-test/t/group_by.test40
-rw-r--r--mysql-test/t/group_by_innodb.test31
-rw-r--r--mysql-test/t/group_by_null.test7
-rw-r--r--mysql-test/t/innodb_ext_key.test28
-rw-r--r--mysql-test/t/innodb_icp.test28
-rw-r--r--mysql-test/t/insert.test18
-rw-r--r--mysql-test/t/myisam_optimize.test1
-rw-r--r--mysql-test/t/mysql_tzinfo_to_sql_symlink.test24
-rw-r--r--mysql-test/t/mysql_upgrade.test5
-rw-r--r--mysql-test/t/order_by.test32
-rw-r--r--mysql-test/t/perror.test2
-rw-r--r--mysql-test/t/plugin_vars.test56
-rw-r--r--mysql-test/t/processlist.test2
-rw-r--r--mysql-test/t/quick_select_4161.test1
-rw-r--r--mysql-test/t/repair.test20
-rw-r--r--mysql-test/t/repair_symlink-5543.test26
-rw-r--r--mysql-test/t/sp-bugs.test57
-rw-r--r--mysql-test/t/subselect_sj.test1
-rw-r--r--mysql-test/t/subselect_sj_mat.test40
-rw-r--r--mysql-test/t/timezone2.test6
-rw-r--r--mysql-test/t/view.test45
27 files changed, 646 insertions, 34 deletions
diff --git a/mysql-test/t/alter_table_trans.test b/mysql-test/t/alter_table_trans.test
index 9096a392af4..29b9b4c212f 100644
--- a/mysql-test/t/alter_table_trans.test
+++ b/mysql-test/t/alter_table_trans.test
@@ -13,3 +13,23 @@ drop table if exists t1,t2;
CREATE TABLE t1 (a INT, INDEX(a)) engine=innodb;
ALTER TABLE t1 RENAME TO t2, DISABLE KEYS;
DROP TABLE t2;
+
+#
+# MDEV-5406 add index to an innodb table with a uniqueness violation crashes mysqld
+#
+
+CREATE TABLE t1 (
+ col4 text NOT NULL,
+ col2 int(11) NOT NULL DEFAULT '0',
+ col3 int(11) DEFAULT NULL,
+ extra int(11) DEFAULT NULL,
+ KEY idx (col4(10))
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+insert t1 values (repeat('1', 8193),3,1,1);
+insert t1 values (repeat('3', 8193),3,1,1);
+--error ER_DUP_ENTRY
+ALTER TABLE t1 ADD PRIMARY KEY (col4(10)) , ADD UNIQUE KEY uidx (col3);
+DROP TABLE t1;
+
+
diff --git a/mysql-test/t/assign_key_cache-5405.test b/mysql-test/t/assign_key_cache-5405.test
new file mode 100644
index 00000000000..2839e040bd3
--- /dev/null
+++ b/mysql-test/t/assign_key_cache-5405.test
@@ -0,0 +1,27 @@
+#
+# MDEV-5405 RQG induced crash in mi_assign_to_key_cache in safe mutex unlock
+#
+--source include/have_debug_sync.inc
+create table t1 (f int, key(f)) engine=myisam;
+set global kc1.key_buffer_size = 65536;
+
+connect (con1, localhost, root);
+
+set debug_sync='assign_key_cache_op_unlock wait_for op_locked';
+send cache index t1 in kc1;
+
+connection default;
+sleep 1;
+set debug_sync='assign_key_cache_op_lock signal op_locked wait_for assigned';
+send cache index t1 in kc1;
+
+connection con1;
+reap;
+set debug_sync='now signal assigned';
+disconnect con1;
+connection default;
+reap;
+
+drop table t1;
+set global kc1.key_buffer_size = 0;
+set debug_sync='reset';
diff --git a/mysql-test/t/date_formats.test b/mysql-test/t/date_formats.test
index 7e6990f4754..972543aefc2 100644
--- a/mysql-test/t/date_formats.test
+++ b/mysql-test/t/date_formats.test
@@ -32,6 +32,8 @@ ORDER BY variable_name;
# SET date_format='%d.%m.%Y';
# SET date_format='%m-%d-%Y';
#
+# --error ER_WRONG_VALUE_FOR_VAR
+# SET datetime_format= NULL;
# set datetime_format= '%Y%m%d%H%i%s';
# set datetime_format= '%Y-%m-%d %H:%i:%s';
# set datetime_format= '%m-%d-%y %H:%i:%s.%f';
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 559a8b76280..4b1d7604b9d 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -394,6 +394,35 @@ WHERE tmp.b;
SELECT * FROM
( SELECT 100 a, subsel.b FROM ( SELECT 200 b ) subsel ) tmp
WHERE tmp.a;
+
+--echo #
+--echo # MDEV-5356: Server crashes in Item_equal::contains on 2nd
+--echo # execution of a PS
+--echo #
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,2),(3,4);
+
+CREATE TABLE t2 (c INT);
+INSERT INTO t2 VALUES (5),(6);
+
+CREATE TABLE t3 (d INT);
+INSERT INTO t3 VALUES (7),(8);
+
+CREATE PROCEDURE pr()
+ UPDATE t3,
+ (SELECT c FROM
+ (SELECT 1 FROM t1 WHERE a=72 AND NOT b) sq,
+ t2
+ ) sq2
+ SET d=sq2.c;
+
+CALL pr();
+CALL pr();
+CALL pr();
+
+drop procedure pr;
+drop table t1,t2,t3;
+
--echo # End of 5.3 tests
--echo #
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test
index 3da58d8ae23..61e11cebad4 100644
--- a/mysql-test/t/derived_view.test
+++ b/mysql-test/t/derived_view.test
@@ -1591,6 +1591,118 @@ EXPLAIN EXTENDED SELECT a FROM v1 WHERE a > 100 ORDER BY b;
DROP VIEW v1;
DROP TABLE t1;
+#
+# MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
+#
+CREATE TABLE IF NOT EXISTS `galleries` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `year` int(11) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE IF NOT EXISTS `pictures` (
+ `id` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `width` float DEFAULT NULL,
+ `height` float DEFAULT NULL,
+ `year` int(4) DEFAULT NULL,
+ `technique` varchar(50) DEFAULT NULL,
+ `comment` varchar(2000) DEFAULT NULL,
+ `gallery_id` int(11) NOT NULL,
+ `type` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `gallery_id` (`gallery_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
+
+ALTER TABLE `pictures`
+ ADD CONSTRAINT `pictures_ibfk_1` FOREIGN KEY (`gallery_id`) REFERENCES `galleries` (`id`);
+
+INSERT INTO `galleries` (`id`, `name`, `year`) VALUES
+(1, 'Quand le noir et blanc invite le taupe', 2013),
+(2, 'Une touche de couleur', 2012),
+(3, 'Éclats', 2011),
+(4, 'Gris béton', 2010),
+(5, 'Expression du spalter', 2010),
+(6, 'Zénitude', 2009),
+(7, 'La force du rouge', 2008),
+(8, 'Sphères', NULL),
+(9, 'Centre', 2009),
+(10, 'Nébuleuse', NULL);
+
+INSERT INTO `pictures` (`id`, `name`, `width`, `height`, `year`, `technique`, `comment`, `gallery_id`, `type`) VALUES
+(1, 'Éclaircie', 72.5, 100, NULL, NULL, NULL, 1, 1),
+(2, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1),
+(3, 'Nouveau souffle', 72.5, 100, NULL, NULL, NULL, 1, 1),
+(4, 'Échanges (2)', 89, 116, NULL, NULL, NULL, 1, 1),
+(5, 'Échanges', 89, 116, NULL, NULL, NULL, 1, 1),
+(6, 'Fenêtre de vie', 81, 116, NULL, NULL, NULL, 1, 1),
+(7, 'Architecture', 81, 100, NULL, NULL, NULL, 1, 1),
+(8, 'Nouveau souffle (2)', 72.5, 100, NULL, NULL, NULL, 1, 1),
+(9, 'Fluidité', 89, 116, NULL, NULL, NULL, 1, 1),
+(10, 'Nouveau Monde', 89, 125, NULL, NULL, NULL, 1, 1),
+(11, 'Mirage', 73, 100, NULL, NULL, NULL, 1, 1),
+(12, 'Équilibre', 72.5, 116, NULL, NULL, NULL, 2, 1),
+(13, 'Fusion', 72.5, 116, NULL, NULL, NULL, 2, 1),
+(14, 'Étincelles', NULL, NULL, NULL, NULL, NULL, 3, 1),
+(15, 'Régénérescence', NULL, NULL, NULL, NULL, NULL, 3, 1),
+(16, 'Chaleur', 80, 80, NULL, NULL, NULL, 4, 1),
+(17, 'Création', 90, 90, NULL, NULL, NULL, 4, 1),
+(18, 'Horizon', 92, 73, NULL, NULL, NULL, 4, 1),
+(19, 'Labyrinthe', 81, 100, NULL, NULL, NULL, 4, 1),
+(20, 'Miroir', 80, 116, NULL, NULL, NULL, 5, 1),
+(21, 'Libération', 81, 116, NULL, NULL, NULL, 5, 1),
+(22, 'Éclats', 81, 116, NULL, NULL, NULL, 5, 1),
+(23, 'Zénitude', 116, 89, NULL, NULL, NULL, 6, 1),
+(24, 'Écritures lointaines', 90, 90, NULL, NULL, NULL, 7, 1),
+(25, 'Émergence', 80, 80, NULL, NULL, NULL, 7, 1),
+(26, 'Liberté', 50, 50, NULL, NULL, NULL, 7, 1),
+(27, 'Silhouettes amérindiennes', 701, 70, NULL, NULL, NULL, 7, 1),
+(28, 'Puissance', 81, 100, NULL, NULL, NULL, 8, 1),
+(29, 'Source', 73, 116, NULL, NULL, NULL, 8, 1),
+(30, 'Comme une ville qui prend vie', 50, 100, 2008, NULL, NULL, 9, 1),
+(31, 'Suspension azur', 80, 80, NULL, NULL, NULL, 9, 1),
+(32, 'Nébuleuse', 70, 70, NULL, NULL, NULL, 10, 1),
+(33, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
+(34, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
+(35, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
+(36, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
+(37, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2),
+(38, 'Œuvre commandée 120 P', 114, 195, NULL, NULL, NULL, 1, 2);
+
+# Now we only lest explain to be sure that table materialized. If
+# in the future merged derived table will be processed in a way that
+# rand() can be called only once then other way of testing correctness
+# of this query should be put here.
+explain
+SELECT g.id AS gallery_id,
+ g.name AS gallery_name,
+ p.id AS picture_id,
+ p.name AS picture_name,
+ g.p_random AS r1,
+ g.p_random AS r2,
+ g.p_random AS r3
+FROM
+(
+ SELECT gal.id,
+ gal.name,
+ (
+ SELECT pi.id
+ FROM pictures pi
+ WHERE pi.gallery_id = gal.id
+ ORDER BY RAND()
+ LIMIT 1
+ ) AS p_random
+ FROM galleries gal
+) g
+LEFT JOIN pictures p
+ ON p.id = g.p_random
+ORDER BY gallery_name ASC
+;
+
+drop table galleries, pictures;
+
--echo #
--echo # end of 5.3 tests
--echo #
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test
index b9e57483b7e..9767959ecb5 100644
--- a/mysql-test/t/func_time.test
+++ b/mysql-test/t/func_time.test
@@ -1449,3 +1449,23 @@ SELECT EXTRACT(HOUR FROM '1 02:00:00'), EXTRACT(HOUR FROM '26:00:00');
SELECT EXTRACT(HOUR FROM TIME'1 02:00:00'), EXTRACT(HOUR FROM TIME'26:00:00');
SELECT EXTRACT(HOUR FROM TIME('1 02:00:00')), EXTRACT(HOUR FROM TIME('26:00:00'));
SELECT EXTRACT(DAY FROM TIME('1 02:00:00')), EXTRACT(DAY FROM TIME('26:00:00'));
+
+--echo #
+--echo # MDEV-5458 RQG hits 'sql/tztime.cc:799: my_time_t sec_since_epoch(int, int, int, int, int, int): Assertion `mon > 0 && mon < 13' failed.'
+--echo #
+SET TIMESTAMP=UNIX_TIMESTAMP('2014-01-22 18:19:20');
+CREATE TABLE t1 (t TIME);
+INSERT INTO t1 VALUES ('03:22:30'),('18:30:05');
+SELECT CONVERT_TZ(GREATEST(t, CURRENT_DATE()), '+02:00', '+10:00') FROM t1;
+SELECT GREATEST(t, CURRENT_DATE()) FROM t1;
+DROP TABLE t1;
+SET TIMESTAMP=DEFAULT;
+
+
+--echo #
+--echo # MDEV-5504 Server crashes in String::length on SELECT with MONTHNAME, GROUP BY, ROLLUP
+--echo #
+CREATE TABLE t1 (i INT);
+INSERT INTO t1 VALUES (1),(2);
+SELECT 1 FROM t1 GROUP BY MONTHNAME(0) WITH ROLLUP;
+DROP TABLE t1;
diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test
index 03aeca605b8..1a18522d46f 100644
--- a/mysql-test/t/group_by.test
+++ b/mysql-test/t/group_by.test
@@ -1,5 +1,3 @@
---source include/have_innodb.inc
-
# Initialise
--disable_warnings
drop table if exists t1,t2,t3;
@@ -1336,7 +1334,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),
(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
let $query0=SELECT col1 AS field1, col1 AS field2
- FROM t1 GROUP BY field1, field2;
+ FROM t1 GROUP BY field1, field2+0;
# Needs to be range to exercise bug
--eval EXPLAIN $query0;
@@ -1366,7 +1364,9 @@ LIMIT 3;
explain
select col1 f1, col1 f2 from t1 order by f2, f1;
-select col1 f1, col1 f2 from t1 order by f2, f1;
+explain
+select col1 f1, col1 f2 from t1 order by f2, f1+0;
+select col1 f1, col1 f2 from t1 order by f2, f1+0;
explain
select col1 f1, col1 f2 from t1 group by f2 order by f2, f1;
@@ -1386,12 +1386,12 @@ INSERT INTO t2(col1, col2) VALUES
(11,10),(12,9),(13,8),(14,7),(15,6),(16,5),(17,4),(18,3),(19,2),(20,1);
explain
-select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
-select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3;
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
+select col1 f1, col2 f2, col1 f3 from t2 group by f1, f2, f3+0;
explain
-select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
-select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3;
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
+select col1 f1, col2 f2, col1 f3 from t2 order by f1, f2, f3+0;
DROP VIEW v1;
DROP TABLE t1, t2;
@@ -1644,30 +1644,6 @@ FROM t1 JOIN t2 ON c = b GROUP BY b WITH ROLLUP;
DROP TABLE t1,t2;
--echo #
---echo # Test of MDEV-4002
---echo #
-
-CREATE TABLE t1 (
- pk INT NOT NULL PRIMARY KEY,
- d1 DOUBLE,
- d2 DOUBLE,
- i INT NOT NULL DEFAULT '0',
- KEY (i)
-) ENGINE=InnoDB;
-
-INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
-
-PREPARE stmt FROM "
-SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
-FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
-";
-
-EXECUTE stmt;
-EXECUTE stmt;
-
-DROP TABLE t1;
-
---echo #
--echo # Bug #58782
--echo # Missing rows with SELECT .. WHERE .. IN subquery
--echo # with full GROUP BY and no aggr
diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test
index 0d5e5e9ae30..df213cc189f 100644
--- a/mysql-test/t/group_by_innodb.test
+++ b/mysql-test/t/group_by_innodb.test
@@ -4,6 +4,8 @@
--source include/have_innodb.inc
+set @save_ext_key_optimizer_switch=@@optimizer_switch;
+
--echo #
--echo # MDEV-3992 Server crash or valgrind errors in test_if_skip_sort_order/test_if_cheaper_ordering
--echo # on GROUP BY with indexes on InnoDB table
@@ -15,6 +17,8 @@ CREATE TABLE t1 (
KEY (pk)
) ENGINE=InnoDB;
+set optimizer_switch='extended_keys=on';
+
INSERT INTO t1 VALUES (1,'a'),(2,'b');
EXPLAIN
@@ -35,4 +39,31 @@ WHERE a = 'r' OR pk = 183 GROUP BY field1, field1;
drop table t1;
+set optimizer_switch=@save_ext_key_optimizer_switch;
+
+--echo #
+--echo # MDEV-4002 Server crash or valgrind errors in Item_func_group_concat::setup and Item_func_group_concat::add
+--echo #
+
+CREATE TABLE t1 (
+ pk INT NOT NULL PRIMARY KEY,
+ d1 DOUBLE,
+ d2 DOUBLE,
+ i INT NOT NULL DEFAULT '0',
+ KEY (i)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES (1,1.0,1.1,1),(2,2.0,2.2,2);
+
+PREPARE stmt FROM "
+SELECT DISTINCT i, GROUP_CONCAT( d1, d2 ORDER BY d1, d2 )
+FROM t1 a1 NATURAL JOIN t1 a2 GROUP BY i WITH ROLLUP
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1;
+
--echo End of 5.5 tests
+
diff --git a/mysql-test/t/group_by_null.test b/mysql-test/t/group_by_null.test
new file mode 100644
index 00000000000..b3fa2a003ec
--- /dev/null
+++ b/mysql-test/t/group_by_null.test
@@ -0,0 +1,7 @@
+#
+# MDEV-5461 Assertion `length <= column->length' fails in write_block_record with functions in select list, GROUP BY, ORDER BY
+#
+create table t1 (a int);
+insert into t1 values (1),(2);
+select max('foo') from t1 group by values(a), extractvalue('bar','qux') order by "v";
+drop table t1;
diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test
index 36414105917..6d1890ac1f9 100644
--- a/mysql-test/t/innodb_ext_key.test
+++ b/mysql-test/t/innodb_ext_key.test
@@ -662,6 +662,34 @@ ORDER BY rev_timestamp ASC LIMIT 10;
DROP TABLE t1,t2,t3;
+--echo #
+--echo # MDEV-5424 SELECT using ORDER BY DESC and LIMIT produces unexpected
+--echo # results (InnoDB/XtraDB)
+--echo #
+
+create table t1 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = myisam default character set utf8;
+create table t2 (a bigint not null unique auto_increment, b varchar(10), primary key (a), key (b(2))) engine = innodb default character set utf8;
+
+insert into t1 (b) values (null), (null), (null);
+insert into t2 (b) values (null), (null), (null);
+
+set optimizer_switch='extended_keys=on';
+explain select a from t1 where b is null order by a desc limit 2;
+select a from t1 where b is null order by a desc limit 2;
+explain select a from t2 where b is null order by a desc limit 2;
+select a from t2 where b is null order by a desc limit 2;
+set optimizer_switch='extended_keys=off';
+explain select a from t2 where b is null order by a desc limit 2;
+select a from t2 where b is null order by a desc limit 2;
+
+explain select a from t2 where b is null order by a desc;
+select a from t2 where b is null order by a desc;
+
+explain select a from t2 where b is null order by a desc,a,a;
+select a from t2 where b is null order by a desc,a,a;
+
+drop table t1, t2;
+
set optimizer_switch=@save_optimizer_switch;
set optimizer_switch=@save_ext_key_optimizer_switch;
diff --git a/mysql-test/t/innodb_icp.test b/mysql-test/t/innodb_icp.test
index d6caa36a88e..acb8238e01f 100644
--- a/mysql-test/t/innodb_icp.test
+++ b/mysql-test/t/innodb_icp.test
@@ -45,6 +45,34 @@ ORDER BY e;
DROP TABLE t1,t2,t3;
+--echo #
+--echo # MDEV-5337: Wrong result in mariadb 5.5.32 with ORDER BY + LIMIT when index_condition_pushdown=on
+--echo # MDEV-5512: Wrong result (WHERE clause ignored) with multiple clauses using Percona-XtraDB engine
+--echo #
+
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (pk int primary key,
+ key1 char(32),
+ key2 char(32),
+ key(key1),
+ key(key2)
+) engine=innodb;
+
+insert into t2 select
+ A.a+10*B.a+100*C.a,
+ concat('rare-', A.a+10*B.a),
+ concat('rare-', A.a+10*B.a)
+from
+ t1 A, t1 B, t1 C;
+update t2 set key1='frequent-val' where pk between 100 and 350;
+select * from t2 ignore key(PRIMARY)
+where key1='frequent-val' and key2 between 'rare-400' and 'rare-450' order by pk limit 2;
+
+drop table t1, t2;
+
+
set optimizer_switch=@innodb_icp_tmp;
set storage_engine= @save_storage_engine;
diff --git a/mysql-test/t/insert.test b/mysql-test/t/insert.test
index f9b9fcf266d..ff8396fd7fd 100644
--- a/mysql-test/t/insert.test
+++ b/mysql-test/t/insert.test
@@ -555,3 +555,21 @@ INSERT IGNORE t1 (a, a) SELECT 1,1;
INSERT IGNORE t1 (a, a) SELECT 1,1 UNION SELECT 2,2;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-5168: Ensure that we can disable duplicate key warnings
+--echo # from INSERT IGNORE
+--echo #
+
+create table t1 (f1 int unique, f2 int unique);
+insert into t1 values (1,12);
+insert into t1 values (2,13);
+--error ER_DUP_ENTRY
+insert into t1 values (1,12);
+insert ignore into t1 values (1,12);
+set @@old_mode="NO_DUP_KEY_WARNINGS_WITH_IGNORE";
+insert ignore into t1 values (1,12);
+insert ignore into t1 values (1,12) on duplicate key update f2=13;
+set @@old_mode="";
+insert ignore into t1 values (1,12);
+DROP TABLE t1;
diff --git a/mysql-test/t/myisam_optimize.test b/mysql-test/t/myisam_optimize.test
index 2d630f7dbd0..5f0b8fc7666 100644
--- a/mysql-test/t/myisam_optimize.test
+++ b/mysql-test/t/myisam_optimize.test
@@ -44,4 +44,5 @@ disconnect con2;
connection default;
drop table t1;
+set debug_sync='reset';
diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
index d29d40f5679..1ba4e91be3c 100644
--- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test
@@ -8,8 +8,32 @@
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
+--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
+--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
+--echo # Verbose run
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
+
+--echo # Silent run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
+--echo #
+--echo # Testing with explicit timezonefile
+--echo #
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
+
+--echo #
+--echo # Testing --leap
+--echo #
+
+--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
+
+#
+# Cleanup
+#
+
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 2018861b2da..98f21a181ee 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -40,6 +40,11 @@ GRANT ALL ON *.* TO mysqltest1@'%';
DROP USER mysqltest1@'%';
+#
+# check that we get proper error messages if wrong user
+
+--error 1
+--exec $MYSQL_UPGRADE --force --user=mysqltest1 --password=sakila 2>&1
#
# Bug #26639 mysql_upgrade exits successfully even if external command failed
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index d573c3b5b8a..c4a85e4b111 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -261,6 +261,9 @@ desc,b desc;
explain select * from t1 where a = 2 and b > 0 order by a desc,b desc;
explain select * from t1 where a = 2 and b < 2 order by a desc,b desc;
explain select * from t1 where a = 1 order by b desc;
+explain select * from t1 where a = 2 and b > 0 order by a desc,b desc,b,a;
+explain select * from t1 where a = 2 and b < 2 order by a desc,a,b desc,a,b;
+
select * from t1 where a = 1 order by b desc;
#
# Test things when we don't have NULL keys
@@ -1913,6 +1916,35 @@ SELECT t1.a FROM t1 LEFT JOIN t2 ON t1.a=t2.a ORDER BY t1.a LIMIT 100;
DROP TABLE t1,t2;
+--echo #
+--echo # MDEV-4974 memory leak in 5.5.32-MariaDB-1~wheezy-log
+--echo #
+set sort_buffer_size=default;
+set max_sort_length=default;
+create table t1(a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t2 (b int,
+ col1 varchar(255),
+ col2 varchar(255)
+ ) character set utf8;
+
+insert into t2 select
+ A.a+10*B.a,
+ concat('wow-wow-col1-value-', A.a+10*B.a+100*C.a),
+ concat('wow-wow-col2-value-', A.a+10*B.a+100*C.a)
+from
+ t1 A, t1 B, t1 C where C.a < 8;
+
+create table t3 as
+select distinct A.col1 as XX, B.col1 as YY
+from
+ t2 A, t2 B
+where A.b = B.b
+order by A.col2, B.col2 limit 10, 1000000;
+
+drop table t1,t2,t3;
+
--echo End of 5.5 tests
diff --git a/mysql-test/t/perror.test b/mysql-test/t/perror.test
index 2b9907c0542..69f1cb3257e 100644
--- a/mysql-test/t/perror.test
+++ b/mysql-test/t/perror.test
@@ -27,7 +27,7 @@ enable_query_log;
--exec $MY_PERROR 1062 2>&1
# test errors that contain characters to escape in the text.
---exec $MY_PERROR 1076 2>&1
+--exec $MY_PERROR 1408 2>&1
--exec $MY_PERROR 1459 2>&1
--exec $MY_PERROR 1461 2>&1
diff --git a/mysql-test/t/plugin_vars.test b/mysql-test/t/plugin_vars.test
new file mode 100644
index 00000000000..8ba8fe2ec0e
--- /dev/null
+++ b/mysql-test/t/plugin_vars.test
@@ -0,0 +1,56 @@
+--echo #
+--echo # MDEV-5345 - Deadlock between mysql_change_user(), SHOW VARIABLES and
+--echo # INSTALL PLUGIN
+--echo #
+
+# Prepare test
+delimiter |;
+CREATE PROCEDURE p_install(x INT)
+BEGIN
+ DECLARE CONTINUE HANDLER FOR 1126 BEGIN END;
+ WHILE x DO
+ SET x= x - 1;
+ INSTALL PLUGIN no_such_plugin SONAME 'no_such_object';
+ END WHILE;
+END|
+
+CREATE PROCEDURE p_show_vars(x INT)
+WHILE x DO
+ SET x= x - 1;
+ SHOW VARIABLES;
+END WHILE|
+delimiter ;|
+
+connect(con1, localhost, root,,);
+connect(con2, localhost, root,,);
+
+# Start test
+connection con1;
+--send CALL p_install(100)
+
+connection con2;
+--send CALL p_show_vars(100)
+
+connection default;
+
+disable_result_log;
+let $i= 100;
+while ($i)
+{
+ change_user;
+ dec $i;
+}
+
+# Cleanup
+connection con1;
+reap;
+connection con2;
+reap;
+connection default;
+enable_result_log;
+
+disconnect con1;
+disconnect con2;
+USE test;
+DROP PROCEDURE p_install;
+DROP PROCEDURE p_show_vars;
diff --git a/mysql-test/t/processlist.test b/mysql-test/t/processlist.test
index c7b775cf992..7a2b33699d5 100644
--- a/mysql-test/t/processlist.test
+++ b/mysql-test/t/processlist.test
@@ -32,4 +32,4 @@ connection default;
select command, time < 5 from information_schema.processlist where id != connection_id();
disconnect con1;
-
+set debug_sync='reset';
diff --git a/mysql-test/t/quick_select_4161.test b/mysql-test/t/quick_select_4161.test
index 1e746754b41..87323087622 100644
--- a/mysql-test/t/quick_select_4161.test
+++ b/mysql-test/t/quick_select_4161.test
@@ -50,4 +50,5 @@ connection default;
disconnect killee;
drop table t1;
+set debug_sync='reset';
diff --git a/mysql-test/t/repair.test b/mysql-test/t/repair.test
index 6536c052019..5b78a352863 100644
--- a/mysql-test/t/repair.test
+++ b/mysql-test/t/repair.test
@@ -190,3 +190,23 @@ set @@autocommit= 0;
repair table t1, t2;
set @@autocommit= default;
drop tables t1, t2;
+
+--echo #
+--echo # Check that we have decent error messages when using crashed
+--echo # .frm file from MySQL 3.23
+--echo #
+
+--echo # Test with a saved table from 3.23
+let $MYSQLD_DATADIR= `select @@datadir`;
+--copy_file std_data/host_old.frm $MYSQLD_DATADIR/test/t1.frm
+--copy_file std_data/host_old.MYD $MYSQLD_DATADIR/test/t1.MYD
+--copy_file std_data/host_old.MYI $MYSQLD_DATADIR/test/t1.MYI
+
+--error ER_GET_ERRNO
+select count(*) from t1;
+check table t1;
+repair table t1;
+repair table t1 use_frm;
+select count(*) from t1;
+check table t1;
+drop table t1;
diff --git a/mysql-test/t/repair_symlink-5543.test b/mysql-test/t/repair_symlink-5543.test
new file mode 100644
index 00000000000..bad65a4175a
--- /dev/null
+++ b/mysql-test/t/repair_symlink-5543.test
@@ -0,0 +1,26 @@
+#
+# MDEV-5543 MyISAM repair unsafe usage of TMD files
+#
+--source include/have_symlink.inc
+--source include/not_windows.inc
+--source include/have_maria.inc
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval create table t1 (a int) engine=myisam data directory='$MYSQL_TMP_DIR';
+insert t1 values (1);
+--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t1.TMD
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+repair table t1;
+drop table t1;
+
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+eval create table t2 (a int) engine=aria data directory='$MYSQL_TMP_DIR';
+insert t2 values (1);
+--system ln -s $MYSQL_TMP_DIR/foobar5543 $MYSQL_TMP_DIR/t2.TMD
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
+repair table t2;
+drop table t2;
+
+--list_files $MYSQL_TMP_DIR foobar5543
+--system rm $MYSQL_TMP_DIR/t1.TMD $MYSQL_TMP_DIR/t2.TMD
+
diff --git a/mysql-test/t/sp-bugs.test b/mysql-test/t/sp-bugs.test
index 3ab1689e8b2..67924996423 100644
--- a/mysql-test/t/sp-bugs.test
+++ b/mysql-test/t/sp-bugs.test
@@ -228,3 +228,60 @@ DROP PROCEDURE testp_bug11763507;
DROP FUNCTION testf_bug11763507;
--echo #END OF BUG#11763507 test.
+
+--echo #
+--echo # MDEV-5531 double call procedure in one session
+--echo #
+
+CREATE TABLE `t1` (
+ `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `create_ts` int(10) unsigned DEFAULT '0',
+ PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;
+
+DELIMITER $$;
+
+CREATE PROCEDURE test_5531 (IN step TINYINT(1))
+BEGIN
+ DECLARE counts INT DEFAULT 0;
+ DECLARE cur1 CURSOR FOR
+
+ SELECT ct.id
+ FROM (SELECT NULL) AS z
+ JOIN (
+ SELECT id
+ FROM `t1`
+ LIMIT 10
+ ) AS ct
+ JOIN (SELECT NULL) AS x ON(
+ EXISTS(
+ SELECT 1
+ FROM `t1`
+ WHERE id=ct.id
+ LIMIT 1
+ )
+ );
+
+ IF step=1 THEN
+ TRUNCATE t1;
+ REPEAT
+ INSERT INTO `t1`
+ (create_ts) VALUES
+ (UNIX_TIMESTAMP());
+
+ SET counts=counts+1;
+ UNTIL counts>150 END REPEAT;
+
+ SET max_sp_recursion_depth=1;
+
+ CALL test_5531(2);
+ SET max_sp_recursion_depth=2;
+ CALL test_5531(2);
+ ELSEIF step=2 THEN
+ OPEN cur1; CLOSE cur1;
+ END IF;
+END $$
+DELIMITER ;$$
+CALL test_5531(1);
+DROP PROCEDURE test_5531;
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect_sj.test b/mysql-test/t/subselect_sj.test
index 536606175bb..a6ce3f25617 100644
--- a/mysql-test/t/subselect_sj.test
+++ b/mysql-test/t/subselect_sj.test
@@ -2634,6 +2634,7 @@ INSERT INTO t2 VALUES ('x');
CREATE TABLE t3 (c3 VARCHAR(1)) ENGINE=MyISAM;
INSERT INTO t3 VALUES ('x'),('d');
+--sorted_result
SELECT * FROM t1, t2 WHERE pk IN ( SELECT pk FROM t1 LEFT JOIN t3 ON (c1 = c3 ) ) ORDER BY c2, c1;
--echo # This should show that "t1 left join t3" is still in the semi-join nest:
diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test
index 58831c4ffb3..52a73d24822 100644
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@ -1725,6 +1725,26 @@ INSERT INTO t1 VALUES (1,3,5),(2,4,6);
SELECT * FROM t1 WHERE 8 IN (SELECT MIN(pk) FROM t1) AND (pk = a OR pk = b);
DROP TABLE t1;
+--echo #
+--echo # MDEV-5368: Server crashes in Item_in_subselect::optimize on 2nd
+--echo # execution of PS with IN subqueries, materialization+semijoin
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(3);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES (8),(9);
+
+PREPARE stmt FROM "
+SELECT * FROM t1 WHERE 1 IN ( SELECT b FROM v2 WHERE 2 IN ( SELECT MAX(a) FROM t1 ) )
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1, t2;
+DROP VIEW v2;
+
--echo # End of 5.3 tests
@@ -1750,5 +1770,25 @@ WHERE ( alias2.c2, alias1.c1 ) IN ( SELECT c4, c3 FROM t2 ) AND alias1.c1 IN ( S
DROP TABLE t1,t2;
set join_cache_level=@tmp_mdev5056;
+--echo #
+--echo # MDEV-5368: Server crashes in Item_in_subselect::optimize on 2nd
+--echo # execution of PS with IN subqueries, materialization+semijoin
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(3);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+CREATE ALGORITHM=MERGE VIEW v2 AS SELECT * FROM t2;
+INSERT INTO t2 VALUES (8),(9);
+
+PREPARE stmt FROM "
+SELECT * FROM t1 WHERE 1 IN ( SELECT b FROM v2 WHERE 2 IN ( SELECT MAX(a) FROM t1 ) )
+";
+
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1, t2;
+DROP VIEW v2;
+
--echo # End of 5.5 tests
diff --git a/mysql-test/t/timezone2.test b/mysql-test/t/timezone2.test
index 7764b39bf33..2d61c7631f2 100644
--- a/mysql-test/t/timezone2.test
+++ b/mysql-test/t/timezone2.test
@@ -298,5 +298,11 @@ SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5');
SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5');
--echo #
+--echo # MDEV-5506 safe_mutex: Trying to lock unitialized mutex at safemalloc.c on server shutdown after SELECT with CONVERT_TZ
+--echo #
+SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' );
+
+
+--echo #
--echo # End of 5.3 tests
--echo #
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 97e5df0349c..927d480e45d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4873,6 +4873,51 @@ deallocate prepare stmt;
drop view v1;
drop table t1,t2;
+#
+# MDEV-5414: RAND() in a subselect : different behavior in MariaDB and MySQL
+#
+create table t1 (a int);
+insert into t1 values (1),(2);
+
+create view v1 (a,r) as select a,rand() from t1;
+
+
+create table t2 select a, r as r1, r as r2, r as r3 from v1;
+
+select a, r1 = r2, r2 = r3 from t2;
+
+drop view v1;
+drop table t1,t2;
+
+--echo #
+--echo # MDEV-5515: 2nd execution of a prepared statement returns wrong results
+--echo #
+CREATE TABLE t1 (i1 INT, j1 INT NOT NULL, PRIMARY KEY (i1));
+
+INSERT INTO t1 VALUES (30,300),(40,400);
+
+CREATE TABLE t2 (i2 INT);
+INSERT INTO t2 VALUES (50),(60);
+
+CREATE TABLE t3 (c3 VARCHAR(20), i3 INT);
+INSERT INTO t3 VALUES ('a',10),('b',2);
+
+CREATE TABLE t4 (i4 INT);
+INSERT INTO t4 VALUES (1),(2);
+
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
+
+CREATE VIEW v2 AS select v1_field1 from t4 join v1;
+
+prepare my_stmt from "select v1_field1 from v2";
+execute my_stmt;
+execute my_stmt;
+deallocate prepare my_stmt;
+
+DROP VIEW v1,v2;
+DROP TABLE t1,t2,t3,t4;
+
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------