diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 9ecaaa66cc346beeb048a8955231178d88020b70..5bc28e9eee52f46c4ae2601b974bc2f5769dad27 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -780,6 +780,8 @@ t1	CREATE TABLE `t1` (
   `i` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
 drop table t1;
+create table t1 (upgrade int);
+drop table t1;
 CREATE TABLE t1 (a int, b int);
 insert into t1 values (1,1),(1,2);
 CREATE TABLE t2 (primary key (a)) select * from t1;
diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result
index 5f12a437eed83687bb75f1b5d590c3dd1aaed40e..230f2a7633fed1da22319590f42067e95c4bc579 100644
--- a/mysql-test/r/func_group_innodb.result
+++ b/mysql-test/r/func_group_innodb.result
@@ -21,7 +21,7 @@ min(7)
 NULL
 select min(7) from DUAL;
 min(7)
-NULL
+7
 explain select min(7) from t2m join t1m;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
@@ -36,7 +36,7 @@ max(7)
 NULL
 select max(7) from DUAL;
 max(7)
-NULL
+7
 explain select max(7) from t2m join t1m;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Select tables optimized away
@@ -75,7 +75,7 @@ min(7)
 NULL
 select min(7) from DUAL;
 min(7)
-NULL
+7
 explain select min(7) from t2i join t1i;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2i	ALL	NULL	NULL	NULL	NULL	1	
@@ -91,7 +91,7 @@ max(7)
 NULL
 select max(7) from DUAL;
 max(7)
-NULL
+7
 explain select max(7) from t2i join t1i;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2i	ALL	NULL	NULL	NULL	NULL	1	
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index f99847a679ac1488f35f453b41dde094123e024e..4d31b2ba496b7510714d2a0d8a8ffbc75a6b2338 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -1142,9 +1142,9 @@ A12  	a12
 EXPLAIN EXTENDED 
 SELECT * FROM t1 INNER JOIN t2 ON code=id 
 WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00');
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ref	code	code	13	const	3	Using where; Using index
-1	SIMPLE	t2	ref	PRIMARY	PRIMARY	12	const	1	Using where; Using index
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ref	code	code	13	const	3	100.00	Using where; Using index
+1	SIMPLE	t2	ref	PRIMARY	PRIMARY	12	const	1	100.00	Using where; Using index
 Warnings:
 Note	1003	select `test`.`t1`.`code` AS `code`,`test`.`t2`.`id` AS `id` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`code` = _latin1'a12') and (`test`.`t2`.`id` = _latin1'a12') and (length(`test`.`t1`.`code`) = 5))
 DROP TABLE t1,t2;
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index 2e4f03a17d927d336ad1d01c2cdf53566ce65a62..34507e0491cb8b689eac2615f2d5e241bad121d8 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -870,8 +870,8 @@ f1
 select f1 from t1 where cast("2006-1-1" as date) between f1 and cast('zzz' as date);
 f1
 Warnings:
-Warning	1292	Truncated incorrect datetime value: 'zzz'
-Warning	1292	Truncated incorrect datetime value: 'zzz'
+Warning	1292	Incorrect datetime value: 'zzz'
+Warning	1292	Incorrect datetime value: 'zzz'
 select f1 from t1 where makedate(2006,1) between date(f1) and date(f3);
 f1
 2006-01-01
diff --git a/mysql-test/r/insert_update.result b/mysql-test/r/insert_update.result
index 169b5286fbeefcb0075537f2e74cf0251bed84d0..baf3f71c4f7018b86bfbdc9c499150620392083a 100644
--- a/mysql-test/r/insert_update.result
+++ b/mysql-test/r/insert_update.result
@@ -62,8 +62,8 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,values(`test`.`t1`.`a`) AS `VALUES(a)` from `test`.`t1`
 explain extended select * from t1 where values(a);
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	Using where
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	100.00	Using where
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where values(`test`.`t1`.`a`)
 DROP TABLE t1;
diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result
index 75258af552b692712f5fe969405201c2b451851c..08d457f7ad79a5e87d29e7f6cbc73c5c41fc0a02 100644
--- a/mysql-test/r/row.result
+++ b/mysql-test/r/row.result
@@ -225,11 +225,11 @@ a	b	a	b	c
 3	1	3	1	3
 EXPLAIN SELECT * FROM t1,t2 WHERE t1.a=t2.a AND t1.b=2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	5	Using where; Using index
+1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using where; Using index
 1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using index
 EXPLAIN SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,2);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	5	Using where; Using index
+1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using where; Using index
 1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using index
 SELECT * FROM t1,t2 WHERE t1.a=1 and t1.b=t2.b;
 a	b	a	b	c
@@ -248,9 +248,9 @@ a	b	a	b	c
 3	2	3	1	1
 3	2	3	1	3
 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
-1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	Using where; Using index
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
+1	SIMPLE	t2	ref	PRIMARY	PRIMARY	4	test.t1.a	1	100.00	Using where; Using index
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`a` = `test`.`t1`.`a`) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
 SELECT * FROM t1,t2 WHERE (t1.a,t1.b)=(t2.a,t2.b+1);
@@ -260,9 +260,9 @@ a	b	a	b	c
 3	2	3	1	1
 3	2	3	1	3
 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	6	Using index
-1	SIMPLE	t2	index	NULL	PRIMARY	12	NULL	7	Using where; Using index
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	8	NULL	6	100.00	Using index
+1	SIMPLE	t2	index	NULL	PRIMARY	12	NULL	7	100.00	Using where; Using index
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where (((`test`.`t1`.`a` - 1) = (`test`.`t2`.`a` - 1)) and (`test`.`t1`.`b` = (`test`.`t2`.`b` + 1)))
 SELECT * FROM t1,t2 WHERE (t1.a-1,t1.b)=(t2.a-1,t2.b+1);
@@ -286,9 +286,9 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
 1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	Using index
 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
-1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	Using index
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	100.00	Using index
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
 SELECT * FROM t1,t2 WHERE (t2.a,(t2.b,t2.c))=(t1.a,(2,1));
@@ -296,9 +296,9 @@ a	b	a	b	c
 1	1	1	2	1
 1	2	1	2	1
 EXPLAIN EXTENDED SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	Using index
-1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	Using index
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	index	PRIMARY	PRIMARY	8	NULL	6	100.00	Using index
+1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	12	test.t1.a,const,const	1	100.00	Using index
 Warnings:
 Note	1003	select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where ((`test`.`t2`.`c` = 1) and (`test`.`t2`.`b` = 2) and (`test`.`t2`.`a` = `test`.`t1`.`a`))
 SELECT * FROM t1,t2 WHERE t2.a=t1.a AND (t2.b,t2.c)=(2,1);
diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result
index 5fdc7275fd78a85ad37b81ebb494fb05505c47a1..9f1719c8e8fdd2560b7f025024d217d9dc14017a 100644
--- a/mysql-test/r/sp.result
+++ b/mysql-test/r/sp.result
@@ -5379,41 +5379,6 @@ Procedure	sql_mode	Create Procedure
 bug21416		CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
 show create procedure bug21416
 drop procedure bug21416|
-drop table if exists t3|
-drop database if exists mysqltest1|
-create table t3 (a int)|
-insert into t3 (a) values (1), (2)|
-create database mysqltest1|
-use mysqltest1|
-drop database mysqltest1|
-select database()|
-database()
-NULL
-select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
-a
-1
-use test|
-drop table t3|
-DROP PROCEDURE IF EXISTS bug16899_p1|
-DROP FUNCTION IF EXISTS bug16899_f1|
-CREATE DEFINER=1234567890abcdefGHIKL@localhost PROCEDURE bug16899_p1()
-BEGIN
-SET @a = 1;
-END|
-ERROR HY000: String '1234567890abcdefGHIKL' is too long for user name (should be no longer than 16)
-CREATE DEFINER=some_user_name@1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY
-FUNCTION bug16899_f1() RETURNS INT
-BEGIN
-RETURN 1;
-END|
-ERROR HY000: String '1234567890abcdefghij1234567890abcdefghij1234567890abcdefghijQWERTY' is too long for host name (should be no longer than 60)
-drop procedure if exists bug21416|
-create procedure bug21416() show create procedure bug21416|
-call bug21416()|
-Procedure	sql_mode	Create Procedure
-bug21416		CREATE DEFINER=`root`@`localhost` PROCEDURE `bug21416`()
-show create procedure bug21416
-drop procedure bug21416|
 CREATE TABLE t3 (
 Member_ID varchar(15) NOT NULL,
 PRIMARY KEY (Member_ID)