From 729826e7780faedc2752b97c2cc39f9a23c9d559 Mon Sep 17 00:00:00 2001
From: Paul McCullagh <paul.mccullagh@primebase.org>
Date: Mon, 17 Aug 2009 17:57:58 +0200
Subject: [PATCH] Updated all tests for RC2

---
 mysql-test/suite/pbxt/r/analyze.result        |   2 +-
 mysql-test/suite/pbxt/r/auto_increment.result |  12 +-
 mysql-test/suite/pbxt/r/delete.result         |  12 +-
 mysql-test/suite/pbxt/r/distinct.result       |   8 +-
 mysql-test/suite/pbxt/r/func_group.result     |  12 +-
 mysql-test/suite/pbxt/r/func_math.result      |   8 +-
 mysql-test/suite/pbxt/r/func_str.result       |   4 +-
 mysql-test/suite/pbxt/r/grant.result          |   2 +-
 mysql-test/suite/pbxt/r/group_min_max.result  | 160 +++++++++---------
 mysql-test/suite/pbxt/r/join.result           |   2 +-
 mysql-test/suite/pbxt/r/join_nested.result    |  48 +++---
 mysql-test/suite/pbxt/r/key.result            |   2 +-
 mysql-test/suite/pbxt/r/key_cache.result      |   4 +-
 mysql-test/suite/pbxt/r/key_diff.result       |   2 +-
 mysql-test/suite/pbxt/r/mysqlshow.result      |  28 +++
 mysql-test/suite/pbxt/r/null.result           |   8 +-
 mysql-test/suite/pbxt/r/null_key.result       |   4 +-
 .../suite/pbxt/r/partition_pruning.result     |   4 +-
 mysql-test/suite/pbxt/r/pbxt_bugs.result      |  56 ++++++
 mysql-test/suite/pbxt/r/pbxt_ref_int.result   |   8 +-
 mysql-test/suite/pbxt/r/preload.result        |   4 +-
 mysql-test/suite/pbxt/r/ps_1general.result    |   6 +-
 mysql-test/suite/pbxt/r/range.result          |   8 +-
 mysql-test/suite/pbxt/r/schema.result         |   2 +
 mysql-test/suite/pbxt/r/select.result         |  40 ++---
 mysql-test/suite/pbxt/r/select_safe.result    |   4 +-
 mysql-test/suite/pbxt/r/subselect.result      |  18 +-
 mysql-test/suite/pbxt/r/type_enum.result      |   8 +-
 mysql-test/suite/pbxt/r/type_ranges.result    |  26 +--
 mysql-test/suite/pbxt/r/type_timestamp.result |  14 +-
 mysql-test/suite/pbxt/r/union.result          |   7 +-
 mysql-test/suite/pbxt/r/view_grant.result     |   4 +-
 mysql-test/suite/pbxt/t/auto_increment.test   |   2 -
 mysql-test/suite/pbxt/t/delete.test           |   3 +
 mysql-test/suite/pbxt/t/join_nested.test      |   3 +
 mysql-test/suite/pbxt/t/null.test             |   2 -
 mysql-test/suite/pbxt/t/pbxt_bugs.test        |  52 ++++++
 mysql-test/suite/pbxt/t/rename.test           |  23 ++-
 mysql-test/suite/pbxt/t/schema.test           |   7 +
 mysql-test/suite/pbxt/t/type_enum.test        |  11 +-
 mysql-test/suite/pbxt/t/union.test            |   7 +
 41 files changed, 414 insertions(+), 223 deletions(-)

diff --git a/mysql-test/suite/pbxt/r/analyze.result b/mysql-test/suite/pbxt/r/analyze.result
index 4e769b6c5b5..d2e7fc29d3a 100644
--- a/mysql-test/suite/pbxt/r/analyze.result
+++ b/mysql-test/suite/pbxt/r/analyze.result
@@ -56,5 +56,5 @@ Table	Op	Msg_type	Msg_text
 test.t1	analyze	status	OK
 show index from t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	1	a	1	a	A	NULL	NULL	NULL	YES	BTREE	
+t1	1	a	1	a	A	5	NULL	NULL	YES	BTREE	
 drop table t1;
diff --git a/mysql-test/suite/pbxt/r/auto_increment.result b/mysql-test/suite/pbxt/r/auto_increment.result
index a945ecebbcc..51c272a4414 100644
--- a/mysql-test/suite/pbxt/r/auto_increment.result
+++ b/mysql-test/suite/pbxt/r/auto_increment.result
@@ -229,7 +229,8 @@ a	b
 204	7
 delete from t1 where a=0;
 update t1 set a=NULL where b=6;
-ERROR 23000: Column 'a' cannot be null
+Warnings:
+Warning	1048	Column 'a' cannot be null
 update t1 set a=300 where b=7;
 SET SQL_MODE='';
 insert into t1(a,b)values(NULL,8);
@@ -244,7 +245,7 @@ a	b
 1	1
 200	2
 201	4
-203	6
+0	6
 300	7
 301	8
 400	9
@@ -260,7 +261,6 @@ a	b
 1	1
 200	2
 201	4
-203	6
 300	7
 301	8
 400	9
@@ -271,20 +271,20 @@ a	b
 405	14
 delete from t1 where a=0;
 update t1 set a=NULL where b=13;
-ERROR 23000: Column 'a' cannot be null
+Warnings:
+Warning	1048	Column 'a' cannot be null
 update t1 set a=500 where b=14;
 select * from t1 order by b;
 a	b
 1	1
 200	2
 201	4
-203	6
 300	7
 301	8
 400	9
 401	10
 402	11
-404	13
+0	13
 500	14
 drop table t1;
 create table t1 (a bigint);
diff --git a/mysql-test/suite/pbxt/r/delete.result b/mysql-test/suite/pbxt/r/delete.result
index 9d337a1ed34..eb4a4ae78d5 100644
--- a/mysql-test/suite/pbxt/r/delete.result
+++ b/mysql-test/suite/pbxt/r/delete.result
@@ -125,18 +125,19 @@ a	b
 0	11
 2	12
 delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
-Warnings:
-Error	1242	Subquery returns more than 1 row
-Error	1242	Subquery returns more than 1 row
+ERROR 21000: Subquery returns more than 1 row
 select * from t11;
 a	b
 0	10
 1	11
+2	12
 select * from t12;
 a	b
 33	10
 0	11
+2	12
 insert into t11 values (2, 12);
+ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
 delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
 ERROR 21000: Subquery returns more than 1 row
 select * from t11;
@@ -145,13 +146,12 @@ a	b
 1	11
 2	12
 delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
-Warnings:
-Error	1242	Subquery returns more than 1 row
-Error	1242	Subquery returns more than 1 row
+ERROR 21000: Subquery returns more than 1 row
 select * from t11;
 a	b
 0	10
 1	11
+2	12
 drop table t11, t12, t2;
 create table t1 (a int, b int, unique key (a), key (b));
 insert into t1 values (3, 3), (7, 7);
diff --git a/mysql-test/suite/pbxt/r/distinct.result b/mysql-test/suite/pbxt/r/distinct.result
index 7da52ea4bd1..c3e8342a6e1 100644
--- a/mysql-test/suite/pbxt/r/distinct.result
+++ b/mysql-test/suite/pbxt/r/distinct.result
@@ -174,8 +174,8 @@ INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
 explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	PRIMARY	NULL	NULL	NULL	4	Using temporary
-1	SIMPLE	t3	ref	a	a	5	test.t1.b	2	Using where; Using index
-1	SIMPLE	t2	index	a	a	4	NULL	5	Using where; Using index; Distinct; Using join buffer
+1	SIMPLE	t2	ref	a	a	4	test.t1.a	1	Using index
+1	SIMPLE	t3	ref	a	a	5	test.t1.b	1	Using where; Using index
 SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
 a
 1
@@ -190,7 +190,7 @@ insert into t3 select * from t4;
 explain select distinct t1.a from t1,t3 where t1.a=t3.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	PRIMARY	PRIMARY	4	NULL	4	Using index; Using temporary
-1	SIMPLE	t3	ref	a	a	5	test.t1.a	11	Using where; Using index; Distinct
+1	SIMPLE	t3	ref	a	a	5	test.t1.a	1	Using where; Using index; Distinct
 select distinct t1.a from t1,t3 where t1.a=t3.a;
 a
 1
@@ -212,7 +212,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	1	Using index
 explain SELECT distinct a from t3 order by a desc limit 2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	index	NULL	a	5	NULL	40	Using index
+1	SIMPLE	t3	index	NULL	a	5	NULL	2	Using index
 explain SELECT distinct a,b from t3 order by a+1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	204	Using temporary; Using filesort
diff --git a/mysql-test/suite/pbxt/r/func_group.result b/mysql-test/suite/pbxt/r/func_group.result
index d5f804dee03..d1a0d09ad09 100644
--- a/mysql-test/suite/pbxt/r/func_group.result
+++ b/mysql-test/suite/pbxt/r/func_group.result
@@ -61,7 +61,7 @@ grp	sum
 NULL	NULL
 1	7
 2	20.25
-3	45.483163247594
+3	45.4831632475944
 create table t2 (grp int, a bigint unsigned, c char(10));
 insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
 replace into t2 select grp, a, c from t1 limit 2,1;
@@ -613,8 +613,8 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 explain
 select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	k1	k1	3	NULL	1	Using where; Using index
-1	SIMPLE	t1	range	k1	k1	7	NULL	1	Using where; Using index; Using join buffer
+1	SIMPLE	t1	range	k1	k1	7	NULL	1	Using where; Using index
+1	SIMPLE	t2	range	k1	k1	3	NULL	1	Using where; Using index; Using join buffer
 explain
 select min(a4 - 0.01) from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -1186,7 +1186,7 @@ std(s1/s2)
 0.21325764
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.21325763586649
+0.213257635866493
 select std(e1/e2) from bug22555;
 std(e1/e2)
 0.21325764
@@ -1212,7 +1212,7 @@ round(std(s1/s2), 17)
 0.21325763586649341
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.21325763586649
+0.213257635866493
 select round(std(e1/e2), 17) from bug22555;
 round(std(e1/e2), 17)
 0.21325763586649341
@@ -1237,7 +1237,7 @@ round(std(s1/s2), 17)
 0.21325763586649341
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.21325763586649
+0.213257635866493
 select round(std(e1/e2), 17) from bug22555;
 round(std(e1/e2), 17)
 0.21325763586649341
diff --git a/mysql-test/suite/pbxt/r/func_math.result b/mysql-test/suite/pbxt/r/func_math.result
index d1cdb7cb76e..d4ce452ef51 100644
--- a/mysql-test/suite/pbxt/r/func_math.result
+++ b/mysql-test/suite/pbxt/r/func_math.result
@@ -60,7 +60,7 @@ Warnings:
 Note	1003	select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
 select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
 log2(8)	log2(15)	log2(-2)	log2(0)	log2(NULL)
-3	3.9068905956085	NULL	NULL	NULL
+3	3.90689059560852	NULL	NULL	NULL
 explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
@@ -68,7 +68,7 @@ Warnings:
 Note	1003	select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
 select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
 log10(100)	log10(18)	log10(-4)	log10(0)	log10(NULL)
-2	1.2552725051033	NULL	NULL	NULL
+2	1.25527250510331	NULL	NULL	NULL
 explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
@@ -85,7 +85,7 @@ Note	1003	select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4
 set @@rand_seed1=10000000,@@rand_seed2=1000000;
 select rand(999999),rand();
 rand(999999)	rand()
-0.014231365187309	0.028870999839968
+0.0142313651873091	0.028870999839968
 explain extended select rand(999999),rand();
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
@@ -101,7 +101,7 @@ Warnings:
 Note	1003	select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
 select degrees(pi()),radians(360);
 degrees(pi())	radians(360)
-180	6.2831853071796
+180	6.28318530717959
 select format(atan(-2, 2), 6);
 format(atan(-2, 2), 6)
 -0.785398
diff --git a/mysql-test/suite/pbxt/r/func_str.result b/mysql-test/suite/pbxt/r/func_str.result
index 59d7b23f9df..b783abb466f 100644
--- a/mysql-test/suite/pbxt/r/func_str.result
+++ b/mysql-test/suite/pbxt/r/func_str.result
@@ -1327,10 +1327,10 @@ cast(rtrim(ltrim('  20.06 ')) as decimal(19,2))
 20.06
 select conv("18383815659218730760",10,10) + 0;
 conv("18383815659218730760",10,10) + 0
-1.8383815659219e+19
+1.83838156592187e+19
 select "18383815659218730760" + 0;
 "18383815659218730760" + 0
-1.8383815659219e+19
+1.83838156592187e+19
 CREATE TABLE t1 (code varchar(10));
 INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
 SELECT ASCII(code), code FROM t1 WHERE code='A12';
diff --git a/mysql-test/suite/pbxt/r/grant.result b/mysql-test/suite/pbxt/r/grant.result
index 24a2b9b4d55..94f89f2fd87 100644
--- a/mysql-test/suite/pbxt/r/grant.result
+++ b/mysql-test/suite/pbxt/r/grant.result
@@ -457,7 +457,7 @@ Privilege	Context	Comment
 Alter	Tables	To alter the table
 Alter routine	Functions,Procedures	To alter or drop stored functions/procedures
 Create	Databases,Tables,Indexes	To create new databases and tables
-Create routine	Functions,Procedures	To use CREATE FUNCTION/PROCEDURE
+Create routine	Databases	To use CREATE FUNCTION/PROCEDURE
 Create temporary tables	Databases	To use CREATE TEMPORARY TABLE
 Create view	Tables	To create new views
 Create user	Server Admin	To create new users
diff --git a/mysql-test/suite/pbxt/r/group_min_max.result b/mysql-test/suite/pbxt/r/group_min_max.result
index e8bd3d98834..a1e2ce15743 100644
--- a/mysql-test/suite/pbxt/r/group_min_max.result
+++ b/mysql-test/suite/pbxt/r/group_min_max.result
@@ -133,34 +133,34 @@ Table	Op	Msg_type	Msg_text
 test.t3	analyze	status	OK
 explain select a1, min(a2) from t1 group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using index for group-by
 explain select a1, max(a2) from t1 group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	65	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	65	NULL	129	Using index for group-by
 explain select a1, min(a2), max(a2) from t1 group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using index for group-by
 explain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 explain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 explain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	NULL	idx_t2_1	#	NULL	#	Using index for group-by
 explain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using index for group-by
 explain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 explain select min(a2) from t1 group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using index for group-by
 explain select a2, min(c), max(c) from t1 group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 select a1, min(a2) from t1 group by a1;
 a1	min(a2)
 a	a
@@ -293,13 +293,13 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	65	NULL	1	Using where
 explain select a1,a2,b,       max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	1	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	2	Using where; Using index for group-by
 explain select a1, max(c)            from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	1	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	2	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	65	NULL	3	Using where; Using index
@@ -669,40 +669,40 @@ d	l421
 d	p422
 explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,max(c),min(c)      from t1 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2, max(c)         from t1 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,max(c),min(c)      from t2 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t2 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t2 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,a2, max(c)         from t2 where (b = 'b') group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,max(c),min(c) from t3 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	range	NULL	idx_t3_1	6	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t3	range	NULL	idx_t3_1	6	NULL	193	Using where; Using index for group-by
 explain select a1,max(c),min(c)      from t3 where (a2 = 'a') and (b = 'b') group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	range	NULL	idx_t3_1	6	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t3	range	NULL	idx_t3_1	6	NULL	193	Using where; Using index for group-by
 select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;
 a1	a2	b	max(c)	min(c)
 a	a	b	h112	e112
@@ -804,22 +804,22 @@ b	h212	e212
 c	h312	e312
 explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,max(c) from t2 where b is NULL group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t2 where b is NULL group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	Using where; Using index for group-by
 select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1;
 a1	a2	b	min(c)
 a	a	NULL	a777
@@ -849,49 +849,49 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	#	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (c > 'f123') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'f123') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (c < 'a0') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (c < 'k321') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'k321') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,       max(c) from t2 where (c > 'b1') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	NULL	idx_t2_1	146	NULL	#	Using where; Using index for group-by
@@ -1364,29 +1364,29 @@ explain select a1,a2,b,min(c),max(c) from t1
 where exists ( select * from t2 where t2.c > 'b1' )
 group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	PRIMARY	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 2	SUBQUERY	t2	index	NULL	idx_t2_1	163	NULL	164	Using where; Using index
 explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c < 'h112') or (c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122')) group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	1	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	2	Using where; Using index for group-by
 explain select a1,a2,b,min(c) from t1 where ((a1 > 'a') or (a1 < '9'))  and ((a2 >= 'b') and (a2 < 'z')) and (b = 'a') and ((c = 'j121') or (c > 'k121' and c < 'm122') or (c > 'o122') or (c < 'h112') or (c = 'c111')) group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	1	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	163	NULL	2	Using where; Using index for group-by
 explain select a1,a2,b,min(c) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	65	NULL	1	Using where
 explain select a1,a2,b,min(c) from t1 where (ord(a1) > 97) and (ord(a2) + ord(a1) > 194) and (b = 'c') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,min(c),max(c) from t2 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	idx_t2_0,idx_t2_1,idx_t2_2	idx_t2_1	163	NULL	#	Using where; Using index for group-by
@@ -1491,13 +1491,13 @@ select a1,a2,b,min(c) from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') grou
 a1	a2	b	min(c)
 explain select a1,a2,b from t1 where (a1 >= 'c' or a2 < 'b') and (b > 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	147	NULL	1	Using where
@@ -1554,13 +1554,13 @@ select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1
 a1	a2	b
 explain select distinct a1,a2,b from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	100.00	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	99.22	Using where; Using index for group-by
 Warnings:
 Note	1003	select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`c` = 'i121') and (`test`.`t1`.`b` = 'a') and (`test`.`t1`.`a2` >= 'b'))
 explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1577,7 +1577,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	NULL	idx_t2_2	146	NULL	#	Using where; Using index for group-by
 explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	10	100.00	Using where; Using index for group-by
+1	SIMPLE	t2	range	NULL	idx_t2_1	163	NULL	165	99.39	Using where; Using index for group-by
 Warnings:
 Note	1003	select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where ((`test`.`t2`.`c` = 'i121') and (`test`.`t2`.`b` = 'a') and (`test`.`t2`.`a2` >= 'b'))
 explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
@@ -1702,19 +1702,19 @@ c	e
 d	e
 explain select distinct a1,a2,b from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 explain select distinct a1,a2,b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	147	NULL	1	Using where
 explain select distinct b from t1 where (a2 >= 'b') and (b = 'a') group by a1,a2,b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using where; Using index for group-by; Using temporary; Using filesort
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by; Using temporary; Using filesort
 explain select distinct a1,a2,b from t2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	NULL	idx_t2_2	146	NULL	#	Using index for group-by
@@ -1846,7 +1846,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	65	NULL	1	Using where
 explain select concat(ord(min(b)),ord(max(b))),min(b),max(b) from t1 group by a1,a2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	10	Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using index for group-by
 select a1,a2,b, concat(min(c), max(c)) from t1 where a1 < 'd' group by a1,a2,b;
 a1	a2	b	concat(min(c), max(c))
 a	a	a	a111d111
@@ -1985,7 +1985,7 @@ c
 d
 explain select a1 from t1 where a2 = 'b' group by a1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using where; Using index for group-by
 select a1 from t1 where a2 = 'b' group by a1;
 a1
 a
@@ -1994,7 +1994,7 @@ c
 d
 explain select distinct a1 from t1 where a2 = 'b';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	10	Using where; Using index for group-by
+1	SIMPLE	t1	range	NULL	idx_t1_1	130	NULL	129	Using where; Using index for group-by
 select distinct a1 from t1 where a2 = 'b';
 a1
 a
@@ -2188,7 +2188,7 @@ INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5),
 (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6);
 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	a	5	NULL	8	Using index for group-by
+1	SIMPLE	t1	index	NULL	a	10	NULL	15	Using index
 FLUSH STATUS;
 SELECT max(b), a FROM t1 GROUP BY a;
 max(b)	a
@@ -2202,7 +2202,7 @@ Handler_read_key	0
 Handler_read_next	0
 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	a	5	NULL	8	Using index for group-by
+1	SIMPLE	t1	index	NULL	a	10	NULL	15	Using index
 FLUSH STATUS;
 CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a;
 SHOW STATUS LIKE 'handler_read__e%';
@@ -2235,14 +2235,14 @@ Handler_read_next	0
 EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION 
 (SELECT max(b), a FROM t1 GROUP BY a);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	t1	range	NULL	a	5	NULL	8	Using index for group-by
-2	UNION	t1	range	NULL	a	5	NULL	8	Using index for group-by
+1	PRIMARY	t1	index	NULL	a	10	NULL	15	Using index
+2	UNION	t1	index	NULL	a	10	NULL	15	Using index
 NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	
 EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
 FROM t1 AS t1_outer;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1_outer	index	NULL	a	10	NULL	15	Using index
-2	SUBQUERY	t1	range	NULL	a	5	NULL	8	Using index for group-by
+2	SUBQUERY	t1	index	NULL	a	10	NULL	15	Using index
 EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS 
 (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -2252,7 +2252,7 @@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE
 (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
-2	SUBQUERY	t1	range	NULL	a	5	NULL	8	Using index for group-by
+2	SUBQUERY	t1	index	NULL	a	10	NULL	15	Using index
 EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE 
 a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -2261,21 +2261,21 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING 
 a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	PRIMARY	t1_outer	range	NULL	a	5	NULL	8	Using index for group-by
-2	SUBQUERY	t1	range	NULL	a	5	NULL	8	Using index for group-by
+1	PRIMARY	t1_outer	index	NULL	a	10	NULL	15	Using index
+2	SUBQUERY	t1	index	NULL	a	10	NULL	15	Using index
 EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 
 ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) 
 AND t1_outer1.b = t1_outer2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1_outer1	ref	a	a	5	const	1	Using where; Using index
 1	PRIMARY	t1_outer2	index	NULL	a	10	NULL	15	Using where; Using index; Using join buffer
-2	SUBQUERY	t1	range	NULL	a	5	NULL	8	Using index for group-by
+2	SUBQUERY	t1	index	NULL	a	10	NULL	15	Using index
 EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x
 FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1_outer2	index	NULL	a	10	NULL	15	Using index
 2	SUBQUERY	t1_outer	index	NULL	a	10	NULL	15	Using index
-3	SUBQUERY	t1	range	NULL	a	5	NULL	8	Using index for group-by
+3	SUBQUERY	t1	index	NULL	a	10	NULL	15	Using index
 CREATE TABLE t3 LIKE t1;
 FLUSH STATUS;
 INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a;
@@ -2312,7 +2312,7 @@ INSERT INTO t1 VALUES
 (4), (2), (1), (2), (2), (4), (1), (4);
 EXPLAIN SELECT DISTINCT(a) FROM t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx	5	NULL	9	Using index for group-by
+1	SIMPLE	t1	index	NULL	idx	5	NULL	16	Using index
 SELECT DISTINCT(a) FROM t1;
 a
 1
@@ -2320,7 +2320,7 @@ a
 4
 EXPLAIN SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	idx	5	NULL	9	Using index for group-by
+1	SIMPLE	t1	index	NULL	idx	5	NULL	16	Using index
 SELECT SQL_BIG_RESULT DISTINCT(a) FROM t1;
 a
 1
@@ -2345,7 +2345,7 @@ CREATE INDEX break_it ON t1 (a, b);
 EXPLAIN
 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	break_it	10	NULL	7	Using index for group-by
+1	SIMPLE	t1	index	NULL	break_it	10	NULL	12	Using index
 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a;
 a	MIN(b)	MAX(b)
 1	1	3
@@ -2355,7 +2355,7 @@ a	MIN(b)	MAX(b)
 EXPLAIN
 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	range	NULL	break_it	10	NULL	7	Using index for group-by; Using temporary; Using filesort
+1	SIMPLE	t1	index	NULL	break_it	10	NULL	12	Using index
 SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC;
 a	MIN(b)	MAX(b)
 4	1	3
diff --git a/mysql-test/suite/pbxt/r/join.result b/mysql-test/suite/pbxt/r/join.result
index 3adcb4fd27a..a74ee3d3b35 100644
--- a/mysql-test/suite/pbxt/r/join.result
+++ b/mysql-test/suite/pbxt/r/join.result
@@ -774,7 +774,7 @@ insert into t3 select * from t2 where a < 800;
 explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	a,b	a	5	NULL	1	Using where
-1	SIMPLE	t3	ref	b	b	5	test.t2.b	11	Using where
+1	SIMPLE	t3	ref	b	b	5	test.t2.b	1	Using where
 drop table t1, t2, t3;
 create table t1 (a int);
 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
diff --git a/mysql-test/suite/pbxt/r/join_nested.result b/mysql-test/suite/pbxt/r/join_nested.result
index a2a2bc6299f..92dc4f8acf2 100644
--- a/mysql-test/suite/pbxt/r/join_nested.result
+++ b/mysql-test/suite/pbxt/r/join_nested.result
@@ -851,7 +851,7 @@ ON t3.a=1 AND t3.b=t2.b AND t2.b=t4.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	2	100.00	
 1	SIMPLE	t4	ALL	NULL	NULL	NULL	NULL	2	100.00	Using join buffer
-1	SIMPLE	t2	ref	idx_b	idx_b	5	test.t3.b	2	100.00	
+1	SIMPLE	t2	ref	idx_b	idx_b	5	test.t3.b	1	100.00	
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
 Warnings:
 Note	1003	select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t3` join `test`.`t4` left join (`test`.`t1` join `test`.`t2`) on(((`test`.`t3`.`a` = 1) and (`test`.`t3`.`b` = `test`.`t2`.`b`) and (`test`.`t2`.`b` = `test`.`t4`.`b`))) where 1
@@ -958,15 +958,15 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t0	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
+1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	1	100.00	
 1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
-1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	2	100.00	Using where
 1	SIMPLE	t5	ALL	idx_b	NULL	NULL	NULL	3	100.00	Using where
 1	SIMPLE	t7	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
 1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
 1	SIMPLE	t8	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer
 Warnings:
-Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
+Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
 CREATE INDEX idx_b ON t8(b);
 EXPLAIN EXTENDED
 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
@@ -1008,14 +1008,14 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
 1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
-1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	2	100.00	Using where
+1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	1	100.00	
 1	SIMPLE	t5	ALL	idx_b	NULL	NULL	NULL	3	100.00	Using where
-1	SIMPLE	t7	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
 1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
-1	SIMPLE	t8	ref	idx_b	idx_b	5	test.t5.b	2	100.00	Using where
+1	SIMPLE	t7	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+1	SIMPLE	t8	ref	idx_b	idx_b	5	test.t5.b	1	100.00	Using where
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer
+Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
 Warnings:
-Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
 CREATE INDEX idx_b ON t1(b);
 CREATE INDEX idx_a ON t0(a);
 EXPLAIN EXTENDED
@@ -1055,17 +1055,17 @@ t0.b=t1.b AND
 (t9.a=1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t0	ref	idx_a	idx_a	5	const	1	100.00	Using where
-1	SIMPLE	t1	ref	idx_b	idx_b	5	test.t0.b	2	100.00	Using where
+1	SIMPLE	t1	ref	idx_b	idx_b	5	test.t0.b	1	100.00	Using where
 1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
 1	SIMPLE	t3	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
-1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	2	100.00	Using where
+1	SIMPLE	t4	ref	idx_b	idx_b	5	test.t2.b	1	100.00	
 1	SIMPLE	t5	ALL	idx_b	NULL	NULL	NULL	3	100.00	Using where
-1	SIMPLE	t7	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
 1	SIMPLE	t6	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
-1	SIMPLE	t8	ref	idx_b	idx_b	5	test.t5.b	2	100.00	Using where
+1	SIMPLE	t7	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+1	SIMPLE	t8	ref	idx_b	idx_b	5	test.t5.b	1	100.00	Using where
 1	SIMPLE	t9	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using join buffer
+Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t3`.`b` = `test`.`t4`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
 Warnings:
-Note	1003	select `test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t5`.`a` AS `a`,`test`.`t5`.`b` AS `b`,`test`.`t6`.`a` AS `a`,`test`.`t6`.`b` AS `b`,`test`.`t7`.`a` AS `a`,`test`.`t7`.`b` AS `b`,`test`.`t8`.`a` AS `a`,`test`.`t8`.`b` AS `b`,`test`.`t9`.`a` AS `a`,`test`.`t9`.`b` AS `b` from `test`.`t0` join `test`.`t1` left join (`test`.`t2` left join (`test`.`t3` join `test`.`t4`) on(((`test`.`t4`.`b` = `test`.`t2`.`b`) and (`test`.`t3`.`a` = 1))) join `test`.`t5` left join (`test`.`t6` join `test`.`t7` left join `test`.`t8` on(((`test`.`t8`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` < 10)))) on(((`test`.`t7`.`b` = `test`.`t5`.`b`) and (`test`.`t6`.`b` >= 2)))) on((((`test`.`t3`.`b` = 2) or isnull(`test`.`t3`.`c`)) and ((`test`.`t6`.`b` = 2) or isnull(`test`.`t6`.`c`)) and ((`test`.`t5`.`b` = `test`.`t0`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t6`.`c`) or isnull(`test`.`t8`.`c`)) and (`test`.`t1`.`a` <> 2))) join `test`.`t9` where ((`test`.`t9`.`a` = 1) and (`test`.`t1`.`b` = `test`.`t0`.`b`) and (`test`.`t0`.`a` = 1) and ((`test`.`t2`.`a` >= 4) or isnull(`test`.`t2`.`c`)) and ((`test`.`t3`.`a` < 5) or isnull(`test`.`t3`.`c`)) and ((`test`.`t4`.`b` = `test`.`t3`.`b`) or isnull(`test`.`t3`.`c`) or isnull(`test`.`t4`.`c`)) and ((`test`.`t5`.`a` >= 2) or isnull(`test`.`t5`.`c`)) and ((`test`.`t6`.`a` >= 4) or isnull(`test`.`t6`.`c`)) and ((`test`.`t7`.`a` <= 2) or isnull(`test`.`t7`.`c`)) and ((`test`.`t8`.`a` < 1) or isnull(`test`.`t8`.`c`)) and ((`test`.`t9`.`b` = `test`.`t8`.`b`) or isnull(`test`.`t8`.`c`)))
 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
 t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
 FROM t0,t1
@@ -1102,21 +1102,21 @@ t0.b=t1.b AND
 (t9.a=1);
 a	b	a	b	a	b	a	b	a	b	a	b	a	b	a	b	a	b	a	b
 1	2	2	2	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1	1
-1	2	3	2	4	2	1	2	3	2	3	1	6	2	1	1	NULL	NULL	1	1
-1	2	3	2	4	2	1	2	3	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
-1	2	3	2	4	2	1	2	4	2	3	1	6	2	1	1	NULL	NULL	1	1
-1	2	3	2	4	2	1	2	4	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
-1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	1	6	2	1	1	NULL	NULL	1	1
-1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
 1	2	2	2	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	1	2
-1	2	3	2	4	2	1	2	3	2	3	1	6	2	1	1	NULL	NULL	1	2
 1	2	3	2	4	2	1	2	3	2	2	2	6	2	2	2	0	2	1	2
+1	2	3	2	4	2	1	2	3	2	3	1	6	2	1	1	NULL	NULL	1	1
+1	2	3	2	4	2	1	2	3	2	3	1	6	2	1	1	NULL	NULL	1	2
+1	2	3	2	4	2	1	2	3	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
 1	2	3	2	4	2	1	2	3	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	2
-1	2	3	2	4	2	1	2	4	2	3	1	6	2	1	1	NULL	NULL	1	2
 1	2	3	2	4	2	1	2	4	2	2	2	6	2	2	2	0	2	1	2
+1	2	3	2	4	2	1	2	4	2	3	1	6	2	1	1	NULL	NULL	1	1
+1	2	3	2	4	2	1	2	4	2	3	1	6	2	1	1	NULL	NULL	1	2
+1	2	3	2	4	2	1	2	4	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
 1	2	3	2	4	2	1	2	4	2	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	2
-1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	1	6	2	1	1	NULL	NULL	1	2
 1	2	3	2	5	3	NULL	NULL	NULL	NULL	2	2	6	2	2	2	0	2	1	2
+1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	1	6	2	1	1	NULL	NULL	1	1
+1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	1	6	2	1	1	NULL	NULL	1	2
+1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	1
 1	2	3	2	5	3	NULL	NULL	NULL	NULL	3	3	NULL	NULL	NULL	NULL	NULL	NULL	1	2
 SELECT t2.a,t2.b
 FROM t2;
@@ -1203,7 +1203,7 @@ EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON c < 3 and b = c;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	NULL	a	5	NULL	21	Using index
 1	SIMPLE	t3	index	c	c	5	NULL	6	Using index
-1	SIMPLE	t2	ref	b	b	5	test.t3.c	2	Using index
+1	SIMPLE	t2	ref	b	b	5	test.t3.c	1	Using index
 EXPLAIN SELECT a, b, c FROM t1 LEFT JOIN (t2, t3) ON b < 3 and b = c;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	NULL	a	5	NULL	#	Using index
@@ -1484,8 +1484,8 @@ explain select * from t1 left join
 on (t1.a = t2.a);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	
-1	SIMPLE	t2	ref	a	a	5	test.t1.a	11	
-1	SIMPLE	t3	ref	a	a	5	test.t2.a	11	
+1	SIMPLE	t2	ref	a	a	5	test.t1.a	1	
+1	SIMPLE	t3	ref	a	a	5	test.t2.a	1	
 drop table t1, t2, t3;
 CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, type varchar(10));
 CREATE TABLE t2 (pid int NOT NULL PRIMARY KEY, type varchar(10));
diff --git a/mysql-test/suite/pbxt/r/key.result b/mysql-test/suite/pbxt/r/key.result
index 0b964a84a4b..d727394f616 100644
--- a/mysql-test/suite/pbxt/r/key.result
+++ b/mysql-test/suite/pbxt/r/key.result
@@ -153,7 +153,7 @@ t1	0	PRIMARY	1	d	A	0	NULL	NULL		BTREE
 t1	0	a	1	a	A	0	NULL	NULL		BTREE	
 t1	0	e	1	e	A	0	NULL	NULL		BTREE	
 t1	0	b	1	b	A	0	NULL	NULL	YES	BTREE	
-t1	1	c	1	c	A	NULL	NULL	NULL	YES	BTREE	
+t1	1	c	1	c	A	0	NULL	NULL	YES	BTREE	
 drop table t1;
 CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
 UNIQUE (c,i));
diff --git a/mysql-test/suite/pbxt/r/key_cache.result b/mysql-test/suite/pbxt/r/key_cache.result
index 8d71c6ce930..5ff41bd29d7 100644
--- a/mysql-test/suite/pbxt/r/key_cache.result
+++ b/mysql-test/suite/pbxt/r/key_cache.result
@@ -122,7 +122,7 @@ i
 explain select count(*) from t1, t2 where t1.p = t2.i;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	index	PRIMARY	PRIMARY	4	NULL	2	Using index
-1	SIMPLE	t2	ref	k1	k1	5	test.t1.p	2	Using where; Using index
+1	SIMPLE	t2	ref	k1	k1	5	test.t1.p	1	Using where; Using index
 select count(*) from t1, t2 where t1.p = t2.i;
 count(*)
 3
@@ -257,8 +257,6 @@ test.t2	assign_to_keycache	note	The storage engine for the table doesn't support
 drop table t1,t2,t3;
 set global keycache2.key_buffer_size=0;
 set global keycache3.key_buffer_size=100;
-Warnings:
-Warning	1292	Truncated incorrect key_buffer_size value: '100'
 set global keycache3.key_buffer_size=0;
 create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;
 insert t1 values ('aaabbb');
diff --git a/mysql-test/suite/pbxt/r/key_diff.result b/mysql-test/suite/pbxt/r/key_diff.result
index 9d26bee4557..33bedfcc39e 100644
--- a/mysql-test/suite/pbxt/r/key_diff.result
+++ b/mysql-test/suite/pbxt/r/key_diff.result
@@ -36,7 +36,7 @@ a	a	a	a
 explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	a	NULL	NULL	NULL	5	
-1	SIMPLE	t2	ALL	b	NULL	NULL	NULL	5	Using where; Using join buffer
+1	SIMPLE	t2	ref	b	b	4	test.t1.a	1	Using where
 select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
 a	b	a	b
 A	B	a	a
diff --git a/mysql-test/suite/pbxt/r/mysqlshow.result b/mysql-test/suite/pbxt/r/mysqlshow.result
index 0e1915dc47a..56b5d125ef3 100644
--- a/mysql-test/suite/pbxt/r/mysqlshow.result
+++ b/mysql-test/suite/pbxt/r/mysqlshow.result
@@ -107,7 +107,21 @@ Database: information_schema
 | TRIGGERS                              |
 | USER_PRIVILEGES                       |
 | VIEWS                                 |
+| INNODB_BUFFER_POOL_PAGES              |
 | PBXT_STATISTICS                       |
+| INNODB_CMP                            |
+| INNODB_RSEG                           |
+| XTRADB_ENHANCEMENTS                   |
+| INNODB_BUFFER_POOL_PAGES_INDEX        |
+| INNODB_INDEX_STATS                    |
+| INNODB_TRX                            |
+| INNODB_CMP_RESET                      |
+| INNODB_LOCK_WAITS                     |
+| INNODB_CMPMEM_RESET                   |
+| INNODB_LOCKS                          |
+| INNODB_CMPMEM                         |
+| INNODB_TABLE_STATS                    |
+| INNODB_BUFFER_POOL_PAGES_BLOB         |
 +---------------------------------------+
 Database: INFORMATION_SCHEMA
 +---------------------------------------+
@@ -141,7 +155,21 @@ Database: INFORMATION_SCHEMA
 | TRIGGERS                              |
 | USER_PRIVILEGES                       |
 | VIEWS                                 |
+| INNODB_BUFFER_POOL_PAGES              |
 | PBXT_STATISTICS                       |
+| INNODB_CMP                            |
+| INNODB_RSEG                           |
+| XTRADB_ENHANCEMENTS                   |
+| INNODB_BUFFER_POOL_PAGES_INDEX        |
+| INNODB_INDEX_STATS                    |
+| INNODB_TRX                            |
+| INNODB_CMP_RESET                      |
+| INNODB_LOCK_WAITS                     |
+| INNODB_CMPMEM_RESET                   |
+| INNODB_LOCKS                          |
+| INNODB_CMPMEM                         |
+| INNODB_TABLE_STATS                    |
+| INNODB_BUFFER_POOL_PAGES_BLOB         |
 +---------------------------------------+
 Wildcard: inf_rmation_schema
 +--------------------+
diff --git a/mysql-test/suite/pbxt/r/null.result b/mysql-test/suite/pbxt/r/null.result
index 775d169a39a..036ba01ed1d 100644
--- a/mysql-test/suite/pbxt/r/null.result
+++ b/mysql-test/suite/pbxt/r/null.result
@@ -93,9 +93,11 @@ INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
 Warnings:
 Warning	1265	Data truncated for column 'd' at row 1
 UPDATE t1 SET d=1/NULL;
-ERROR 23000: Column 'd' cannot be null
+Warnings:
+Warning	1265	Data truncated for column 'd' at row 1
 UPDATE t1 SET d=NULL;
-ERROR 23000: Column 'd' cannot be null
+Warnings:
+Warning	1048	Column 'd' cannot be null
 INSERT INTO t1 (a) values (null);
 ERROR 23000: Column 'a' cannot be null
 INSERT INTO t1 (a) values (1/null);
@@ -130,7 +132,7 @@ Warning	1048	Column 'd' cannot be null
 Warning	1048	Column 'd' cannot be null
 select * from t1;
 a	b	c	d
-	0	0000-00-00 00:00:00	2003
+	0	0000-00-00 00:00:00	0
 	0	0000-00-00 00:00:00	0
 	0	0000-00-00 00:00:00	0
 	0	0000-00-00 00:00:00	0
diff --git a/mysql-test/suite/pbxt/r/null_key.result b/mysql-test/suite/pbxt/r/null_key.result
index c01e0337b32..753ebf31f1c 100644
--- a/mysql-test/suite/pbxt/r/null_key.result
+++ b/mysql-test/suite/pbxt/r/null_key.result
@@ -407,8 +407,8 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
 LEFT JOIN t3 ON t2.b=t3.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	
-1	SIMPLE	t2	ref	idx	idx	5	test.t1.a	2	
-1	SIMPLE	t3	ref	idx	idx	5	test.t2.b	186	Using index
+1	SIMPLE	t2	ref	idx	idx	5	test.t1.a	1	
+1	SIMPLE	t3	ref	idx	idx	5	test.t2.b	1	Using index
 FLUSH STATUS ;
 SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
 LEFT JOIN t3 ON t2.b=t3.b;
diff --git a/mysql-test/suite/pbxt/r/partition_pruning.result b/mysql-test/suite/pbxt/r/partition_pruning.result
index f003f62c163..9938d352ff7 100644
--- a/mysql-test/suite/pbxt/r/partition_pruning.result
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result
@@ -338,12 +338,12 @@ select * from t1 X, t1 Y
 where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	X	p1,p2	ALL	a,b	NULL	NULL	NULL	2	Using where
-1	SIMPLE	Y	p2,p3	ref	a,b	b	4	test.X.b	2	Using where
+1	SIMPLE	Y	p2,p3	ref	a,b	b	4	test.X.b	1	Using where
 explain partitions
 select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	X	p1,p2	ALL	a	NULL	NULL	NULL	4	Using where
-1	SIMPLE	Y	p1,p2	ref	a	a	4	test.X.a	2	
+1	SIMPLE	Y	p1,p2	ref	a	a	4	test.X.a	1	
 drop table t1;
 create table t1 (a int) partition by hash(a) partitions 20;
 insert into t1 values (1),(2),(3);
diff --git a/mysql-test/suite/pbxt/r/pbxt_bugs.result b/mysql-test/suite/pbxt/r/pbxt_bugs.result
index 6ebb8459c75..a6db895d3d2 100644
--- a/mysql-test/suite/pbxt/r/pbxt_bugs.result
+++ b/mysql-test/suite/pbxt/r/pbxt_bugs.result
@@ -1218,3 +1218,59 @@ c1	c2
 0	opq
 1	jkl
 DROP TABLE t1;
+create table parent (id int primary key);
+create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
+insert into parent values (2), (3), (4);
+insert into child values (3), (4);
+delete ignore from parent;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (Constraint: `FOREIGN_1`)
+select * from parent;
+id
+2
+3
+4
+drop table child, parent;
+create schema test378222;
+use test378222;
+create table t1 (id int primary key);
+create table t2 (id int primary key);
+alter table t1 add constraint foreign key (id) references t2 (id);
+alter table t2 add constraint foreign key (id) references t1 (id);
+drop schema test378222;
+create schema test378222a;
+create schema test378222b;
+create table test378222a.t1 (id int primary key);
+create table test378222b.t2 (id int primary key);
+alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
+alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
+set foreign_key_checks = 1;
+drop schema test378222a;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+drop schema test378222b;
+ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
+set foreign_key_checks = 0;
+drop schema test378222a;
+drop schema test378222b;
+set foreign_key_checks = 1;
+use test;
+CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` tinyint(4) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`c1`)
+) ENGINE=PBXT AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(null);
+INSERT INTO t1 VALUES(null);
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+c1
+10
+11
+12
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+c1
+1
+DROP TABLE t1;
diff --git a/mysql-test/suite/pbxt/r/pbxt_ref_int.result b/mysql-test/suite/pbxt/r/pbxt_ref_int.result
index cd86d122452..6f096f064ee 100644
--- a/mysql-test/suite/pbxt/r/pbxt_ref_int.result
+++ b/mysql-test/suite/pbxt/r/pbxt_ref_int.result
@@ -166,7 +166,7 @@ child	CREATE TABLE `child` (
   `parent_id` int(11) DEFAULT NULL,
   KEY `par_ind` (`parent_id`),
   KEY `child_ind` (`id`),
-  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
+  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop index child_ind on child;
 show create table child;
@@ -175,7 +175,7 @@ child	CREATE TABLE `child` (
   `id` int(11) DEFAULT NULL,
   `parent_id` int(11) DEFAULT NULL,
   KEY `par_ind` (`parent_id`),
-  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
+  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 alter table parent add column c1 varchar(40);
 insert child values(2000, 2);
@@ -243,7 +243,7 @@ child	CREATE TABLE `child` (
   `id` int(11) DEFAULT NULL,
   `parent_id` int(11) DEFAULT NULL,
   KEY `par_ind` (`parent_id`),
-  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
+  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 alter table child add column c1 varchar(40);
 insert child values(400, 1, "asd");
@@ -284,7 +284,7 @@ child	CREATE TABLE `child` (
   `id` int(11) DEFAULT NULL,
   `parent_id` int(11) DEFAULT NULL,
   KEY `par_ind` (`parent_id`),
-  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
+  CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 insert parent values(1);
 insert child values(100, 1);
diff --git a/mysql-test/suite/pbxt/r/preload.result b/mysql-test/suite/pbxt/r/preload.result
index 285b58e210e..cdd19dec861 100644
--- a/mysql-test/suite/pbxt/r/preload.result
+++ b/mysql-test/suite/pbxt/r/preload.result
@@ -144,7 +144,7 @@ Key_reads	0
 load index into cache t3, t2 key (primary,b) ;
 Table	Op	Msg_type	Msg_text
 test.t3	preload_keys	Error	Table 'test.t3' doesn't exist
-test.t3	preload_keys	error	Corrupt
+test.t3	preload_keys	status	Operation failed
 test.t2	preload_keys	note	The storage engine for the table doesn't support preload_keys
 show status like "key_read%";
 Variable_name	Value
@@ -159,7 +159,7 @@ Key_reads	0
 load index into cache t3 key (b), t2 key (c) ;
 Table	Op	Msg_type	Msg_text
 test.t3	preload_keys	Error	Table 'test.t3' doesn't exist
-test.t3	preload_keys	error	Corrupt
+test.t3	preload_keys	status	Operation failed
 test.t2	preload_keys	note	The storage engine for the table doesn't support preload_keys
 show status like "key_read%";
 Variable_name	Value
diff --git a/mysql-test/suite/pbxt/r/ps_1general.result b/mysql-test/suite/pbxt/r/ps_1general.result
index 6584274ecf6..79bc0597f2c 100644
--- a/mysql-test/suite/pbxt/r/ps_1general.result
+++ b/mysql-test/suite/pbxt/r/ps_1general.result
@@ -289,7 +289,7 @@ prepare stmt4 from ' show index from t2 from test ';
 execute stmt4;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t2	0	PRIMARY	1	a	A	0	NULL	NULL		BTREE	
-t2	1	t2_idx	1	b	A	NULL	NULL	NULL	YES	BTREE	
+t2	1	t2_idx	1	b	A	0	NULL	NULL	YES	BTREE	
 prepare stmt4 from ' show table status from test like ''t2%'' ';
 execute stmt4;
 Name	Engine	Version	Row_format	Rows	Avg_row_length	Data_length	Max_data_length	Index_length	Data_free	Auto_increment	Create_time	Update_time	Check_time	Collation	Checksum	Create_options	Comment
@@ -447,7 +447,7 @@ def					type	253	10	3	Y	0	31	8
 def					possible_keys	253	4096	0	Y	0	31	8
 def					key	253	64	0	Y	0	31	8
 def					key_len	253	4096	0	Y	0	31	8
-def					ref	253	1024	0	Y	0	31	8
+def					ref	253	2048	0	Y	0	31	8
 def					rows	8	10	1	Y	32928	0	63
 def					Extra	253	255	14	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
@@ -463,7 +463,7 @@ def					type	253	10	5	Y	0	31	8
 def					possible_keys	253	4096	7	Y	0	31	8
 def					key	253	64	7	Y	0	31	8
 def					key_len	253	4096	1	Y	0	31	8
-def					ref	253	1024	0	Y	0	31	8
+def					ref	253	2048	0	Y	0	31	8
 def					rows	8	10	1	Y	32928	0	63
 def					Extra	253	255	27	N	1	31	8
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
diff --git a/mysql-test/suite/pbxt/r/range.result b/mysql-test/suite/pbxt/r/range.result
index 758c2a064de..d9cf8ac704f 100644
--- a/mysql-test/suite/pbxt/r/range.result
+++ b/mysql-test/suite/pbxt/r/range.result
@@ -423,19 +423,19 @@ test.t2	analyze	status	OK
 explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	uid_index	uid_index	4	NULL	1	Using where
-1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	12	
+1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	1	
 explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid > 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	uid_index	uid_index	4	NULL	1	Using where
-1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	12	
+1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	1	
 explain select * from t1, t2  where t1.uid=t2.uid AND t1.uid != 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	uid_index	uid_index	4	NULL	2	Using where
-1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	12	
+1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	1	
 explain select * from t1, t2  where t1.uid=t2.uid AND t2.uid != 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	uid_index	uid_index	4	NULL	2	Using where
-1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	12	
+1	SIMPLE	t2	ref	uid_index	uid_index	4	test.t1.uid	1	
 select * from t1, t2  where t1.uid=t2.uid AND t1.uid > 0;
 id	name	uid	id	name	uid
 1001	A	1	1001	A	1
diff --git a/mysql-test/suite/pbxt/r/schema.result b/mysql-test/suite/pbxt/r/schema.result
index 564fb3626df..4167119d932 100644
--- a/mysql-test/suite/pbxt/r/schema.result
+++ b/mysql-test/suite/pbxt/r/schema.result
@@ -3,11 +3,13 @@ create schema foo;
 show create schema foo;
 Database	Create Database
 foo	CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
+create table t1 (id int) engine=pbxt;
 show schemas;
 Database
 information_schema
 foo
 mtr
 mysql
+pbxt
 test
 drop schema foo;
diff --git a/mysql-test/suite/pbxt/r/select.result b/mysql-test/suite/pbxt/r/select.result
index 53127fb0dab..41137e9e8dd 100644
--- a/mysql-test/suite/pbxt/r/select.result
+++ b/mysql-test/suite/pbxt/r/select.result
@@ -604,15 +604,15 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	period	NULL	NULL	NULL	41810	Using temporary; Using filesort
-1	SIMPLE	t3	ref	period	period	4	test.t1.period	18	
+1	SIMPLE	t3	ref	period	period	4	test.t1.period	1	
 explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	index	period	period	4	NULL	1	
-1	SIMPLE	t1	ref	period	period	4	test.t3.period	18	
+1	SIMPLE	t3	index	period	period	4	NULL	10	
+1	SIMPLE	t1	ref	period	period	4	test.t3.period	1	
 explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	period	period	4	NULL	1	
-1	SIMPLE	t3	ref	period	period	4	test.t1.period	18	
+1	SIMPLE	t1	index	period	period	4	NULL	10	
+1	SIMPLE	t3	ref	period	period	4	test.t1.period	1	
 select period from t1;
 period
 9410
@@ -2095,7 +2095,7 @@ show keys from t2;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t2	0	PRIMARY	1	auto	A	1199	NULL	NULL		BTREE	
 t2	0	fld1	1	fld1	A	1199	NULL	NULL		BTREE	
-t2	1	fld3	1	fld3	A	NULL	NULL	NULL		BTREE	
+t2	1	fld3	1	fld3	A	1199	NULL	NULL		BTREE	
 drop table t4, t3, t2, t1;
 DO 1;
 DO benchmark(100,1+1),1,1;
@@ -2369,7 +2369,7 @@ insert into t2 values (1,3), (2,3), (3,4), (4,4);
 explain select * from t1 left join t2 on a=c where d in (4);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ref	c,d	d	5	const	1	Using where
-1	SIMPLE	t1	ref	a	a	5	test.t2.c	2	Using where
+1	SIMPLE	t1	ref	a	a	5	test.t2.c	1	Using where
 select * from t1 left join t2 on a=c where d in (4);
 a	b	c	d
 3	2	3	4
@@ -2377,7 +2377,7 @@ a	b	c	d
 explain select * from t1 left join t2 on a=c where d = 4;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	ref	c,d	d	5	const	1	Using where
-1	SIMPLE	t1	ref	a	a	5	test.t2.c	2	Using where
+1	SIMPLE	t1	ref	a	a	5	test.t2.c	1	Using where
 select * from t1 left join t2 on a=c where d = 4;
 a	b	c	d
 3	2	3	4
@@ -2403,11 +2403,11 @@ INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	
-1	SIMPLE	t2	ref	a	a	23	test.t1.a	2	
+1	SIMPLE	t2	ref	a	a	23	test.t1.a	1	
 EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	5	
-1	SIMPLE	t2	ref	a	a	23	test.t1.a	2	
+1	SIMPLE	t2	ref	a	a	23	test.t1.a	1	
 DROP TABLE t1, t2;
 CREATE TABLE t1 ( city char(30) );
 INSERT INTO t1 VALUES ('London');
@@ -2792,26 +2792,26 @@ 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
 select max(key1) from t1 where key1 <= 0.6158;
 max(key1)
-0.61580002307892
+0.615800023078918
 select max(key2) from t2 where key2 <= 1.6158;
 max(key2)
-1.6158000230789
+1.61580002307892
 select min(key1) from t1 where key1 >= 0.3762;
 min(key1)
-0.37619999051094
+0.376199990510941
 select min(key2) from t2 where key2 >= 1.3762;
 min(key2)
-1.3761999607086
+1.37619996070862
 select max(key1), min(key2) from t1, t2
 where key1 <= 0.6158 and key2 >= 1.3762;
 max(key1)	min(key2)
-0.61580002307892	1.3761999607086
+0.615800023078918	1.37619996070862
 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
 max(key1)
-0.61580002307892
+0.615800023078918
 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
 min(key1)
-0.37619999051094
+0.376199990510941
 DROP TABLE t1,t2;
 CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
 INSERT INTO t1 VALUES (10);
@@ -3454,7 +3454,7 @@ explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
 and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	A	range	PRIMARY	PRIMARY	12	NULL	1	Using where
-1	SIMPLE	B	ref	PRIMARY	PRIMARY	8	const,test.A.e	11	
+1	SIMPLE	B	ref	PRIMARY	PRIMARY	8	const,test.A.e	1	
 drop table t1, t2;
 CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
 INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
@@ -3468,12 +3468,12 @@ EXPLAIN
 SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	PRIMARY,b	b	5	NULL	1	Using where
-1	SIMPLE	t2	ref	c	c	5	test.t1.a	2	Using where
+1	SIMPLE	t2	ref	c	c	5	test.t1.a	1	Using where
 EXPLAIN
 SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	range	PRIMARY,b	PRIMARY	4	NULL	1	Using where
-1	SIMPLE	t2	ref	c	c	5	test.t1.a	2	Using where
+1	SIMPLE	t2	ref	c	c	5	test.t1.a	1	Using where
 DROP TABLE t1, t2;
 create table t1 (
 a int unsigned    not null auto_increment primary key,
diff --git a/mysql-test/suite/pbxt/r/select_safe.result b/mysql-test/suite/pbxt/r/select_safe.result
index 468eb6cc5a9..ea0c2156d55 100644
--- a/mysql-test/suite/pbxt/r/select_safe.result
+++ b/mysql-test/suite/pbxt/r/select_safe.result
@@ -70,12 +70,12 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu
 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	21	
-1	SIMPLE	t2	ref	b	b	21	test.t1.b	2	Using where
+1	SIMPLE	t2	ref	b	b	21	test.t1.b	1	Using where
 set MAX_SEEKS_FOR_KEY=1;
 explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ALL	b	NULL	NULL	NULL	21	
-1	SIMPLE	t2	ref	b	b	21	test.t1.b	2	Using where
+1	SIMPLE	t2	ref	b	b	21	test.t1.b	1	Using where
 SET MAX_SEEKS_FOR_KEY=DEFAULT;
 drop table t1;
 create table t1 (a int);
diff --git a/mysql-test/suite/pbxt/r/subselect.result b/mysql-test/suite/pbxt/r/subselect.result
index 395770111ff..bae93f76b2c 100644
--- a/mysql-test/suite/pbxt/r/subselect.result
+++ b/mysql-test/suite/pbxt/r/subselect.result
@@ -1333,7 +1333,7 @@ a
 explain extended select * from t2 where t2.a in (select a from t1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	t2	index	NULL	a	5	NULL	4	100.00	Using where; Using index
-2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1001	100.00	Using index; Using where
+2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1	100.00	Using index; Using where
 Warnings:
 Note	1003	select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
 select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
@@ -1343,7 +1343,7 @@ a
 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	t2	index	NULL	a	5	NULL	4	100.00	Using where; Using index
-2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1001	100.00	Using index; Using where
+2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1	100.00	Using index; Using where
 Warnings:
 Note	1003	select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
@@ -1353,8 +1353,8 @@ a
 explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	t2	index	NULL	a	5	NULL	4	100.00	Using where; Using index
-2	DEPENDENT SUBQUERY	t1	ref	a	a	5	func	1001	100.00	Using where; Using index
-2	DEPENDENT SUBQUERY	t3	index	a	a	5	NULL	3	100.00	Using where; Using index; Using join buffer
+2	DEPENDENT SUBQUERY	t1	ref	a	a	5	func	1	100.00	Using where; Using index
+2	DEPENDENT SUBQUERY	t3	ref	a	a	5	test.t1.b	1	100.00	Using where; Using index
 Warnings:
 Note	1003	select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
 insert into t1 values (3,31);
@@ -1370,7 +1370,7 @@ a
 explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	t2	index	NULL	a	5	NULL	4	100.00	Using where; Using index
-2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1001	100.00	Using index; Using where
+2	DEPENDENT SUBQUERY	t1	index_subquery	a	a	5	func	1	100.00	Using index; Using where
 Warnings:
 Note	1003	select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
 drop table t1, t2, t3;
@@ -3546,7 +3546,7 @@ ORDER BY t1.t DESC LIMIT 1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	1	
 1	PRIMARY	t1	index	NULL	PRIMARY	16	NULL	11	Using where; Using index; Using join buffer
-2	DEPENDENT SUBQUERY	t1	ref	PRIMARY	PRIMARY	8	test.t2.i1,const	2	Using where; Using index; Using filesort
+2	DEPENDENT SUBQUERY	t1	ref	PRIMARY	PRIMARY	8	test.t2.i1,const	1	Using where; Using index; Using filesort
 SELECT * FROM t1,t2
 WHERE t1.t = (SELECT t1.t FROM t1 
 WHERE t1.t < t2.t  AND t1.i2=1 AND t2.i1=t1.i1
@@ -4214,7 +4214,7 @@ CREATE INDEX I2 ON t1 (b);
 EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
-2	DEPENDENT SUBQUERY	t1	index_subquery	I1	I1	2	func	2	Using index; Using where
+2	DEPENDENT SUBQUERY	t1	index_subquery	I1	I1	2	func	1	Using index; Using where
 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
 a	b
 CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
@@ -4224,14 +4224,14 @@ CREATE INDEX I2 ON t2 (b);
 EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t2	ALL	NULL	NULL	NULL	NULL	2	Using where
-2	DEPENDENT SUBQUERY	t2	index_subquery	I1	I1	4	func	2	Using index; Using where
+2	DEPENDENT SUBQUERY	t2	index_subquery	I1	I1	4	func	1	Using index; Using where
 SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
 a	b
 EXPLAIN
 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	Using where
-2	DEPENDENT SUBQUERY	t1	index_subquery	I1	I1	2	func	2	Using index; Using where
+2	DEPENDENT SUBQUERY	t1	index_subquery	I1	I1	2	func	1	Using index; Using where
 SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
 a	b
 DROP TABLE t1,t2;
diff --git a/mysql-test/suite/pbxt/r/type_enum.result b/mysql-test/suite/pbxt/r/type_enum.result
index 7cfb227e6c5..a84cf0d4edd 100644
--- a/mysql-test/suite/pbxt/r/type_enum.result
+++ b/mysql-test/suite/pbxt/r/type_enum.result
@@ -1776,8 +1776,14 @@ t1	CREATE TABLE `t1` (
   `russian_deviant` enum('E','F','E�F','F,E') NOT NULL DEFAULT 'E'
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
+select @@SESSION.sql_mode;
+@@SESSION.sql_mode
+
+select @@GLOBAL.sql_mode;
+@@GLOBAL.sql_mode
+
 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','	
 
  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆辈炒刀犯购患骄坷谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉哙徕沅彐玷殛腱眍镳耱篝貊鼬�'));
-ERROR HY000: Can't create table 'test.t1' (errno: -1)
+drop table t1;
 End of 5.1 tests
diff --git a/mysql-test/suite/pbxt/r/type_ranges.result b/mysql-test/suite/pbxt/r/type_ranges.result
index 34cabd64bcf..0674dcb4d28 100644
--- a/mysql-test/suite/pbxt/r/type_ranges.result
+++ b/mysql-test/suite/pbxt/r/type_ranges.result
@@ -70,19 +70,19 @@ flags	set('one','two','tree')	latin1_swedish_ci	NO				#
 show keys from t1;
 Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
 t1	0	PRIMARY	1	auto	A	0	NULL	NULL		BTREE	
-t1	1	utiny	1	utiny	A	NULL	NULL	NULL		BTREE	
-t1	1	tiny	1	tiny	A	NULL	NULL	NULL		BTREE	
-t1	1	short	1	short	A	NULL	NULL	NULL		BTREE	
-t1	1	any_name	1	medium	A	NULL	NULL	NULL		BTREE	
-t1	1	longlong	1	longlong	A	NULL	NULL	NULL		BTREE	
-t1	1	real_float	1	real_float	A	NULL	NULL	NULL		BTREE	
-t1	1	ushort	1	ushort	A	NULL	NULL	NULL		BTREE	
-t1	1	umedium	1	umedium	A	NULL	NULL	NULL		BTREE	
-t1	1	ulong	1	ulong	A	NULL	NULL	NULL		BTREE	
-t1	1	ulonglong	1	ulonglong	A	NULL	NULL	NULL		BTREE	
-t1	1	ulonglong	2	ulong	A	NULL	NULL	NULL		BTREE	
-t1	1	options	1	options	A	NULL	NULL	NULL		BTREE	
-t1	1	options	2	flags	A	NULL	NULL	NULL		BTREE	
+t1	1	utiny	1	utiny	A	0	NULL	NULL		BTREE	
+t1	1	tiny	1	tiny	A	0	NULL	NULL		BTREE	
+t1	1	short	1	short	A	0	NULL	NULL		BTREE	
+t1	1	any_name	1	medium	A	0	NULL	NULL		BTREE	
+t1	1	longlong	1	longlong	A	0	NULL	NULL		BTREE	
+t1	1	real_float	1	real_float	A	0	NULL	NULL		BTREE	
+t1	1	ushort	1	ushort	A	0	NULL	NULL		BTREE	
+t1	1	umedium	1	umedium	A	0	NULL	NULL		BTREE	
+t1	1	ulong	1	ulong	A	0	NULL	NULL		BTREE	
+t1	1	ulonglong	1	ulonglong	A	0	NULL	NULL		BTREE	
+t1	1	ulonglong	2	ulong	A	0	NULL	NULL		BTREE	
+t1	1	options	1	options	A	0	NULL	NULL		BTREE	
+t1	1	options	2	flags	A	0	NULL	NULL		BTREE	
 CREATE UNIQUE INDEX test on t1 ( auto ) ;
 CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
 CREATE INDEX test3 on t1 ( medium ) ;
diff --git a/mysql-test/suite/pbxt/r/type_timestamp.result b/mysql-test/suite/pbxt/r/type_timestamp.result
index 2e5a6f46276..47d2a996afd 100644
--- a/mysql-test/suite/pbxt/r/type_timestamp.result
+++ b/mysql-test/suite/pbxt/r/type_timestamp.result
@@ -101,13 +101,13 @@ create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
 t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
 t14 timestamp(14));
 Warnings:
-Warning	1287	The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
-Warning	1287	The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
+Warning	1287	The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
 insert t1 values (0,0,0,0,0,0,0),
 ("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
 "1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
diff --git a/mysql-test/suite/pbxt/r/union.result b/mysql-test/suite/pbxt/r/union.result
index 85fd7203488..04e5aaf6298 100644
--- a/mysql-test/suite/pbxt/r/union.result
+++ b/mysql-test/suite/pbxt/r/union.result
@@ -1301,12 +1301,14 @@ t3	CREATE TABLE `t3` (
   `left(a,100000000)` longtext
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop tables t1,t2,t3;
+SELECT @tmp_max:= @@global.max_allowed_packet;
+@tmp_max:= @@global.max_allowed_packet
+1048576
+SET @@global.max_allowed_packet=25000000;
 CREATE TABLE t1 (a mediumtext);
 CREATE TABLE t2 (b varchar(20));
 INSERT INTO t1 VALUES ('a');
 CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
-Warnings:
-Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
 SHOW CREATE TABLE t3;
 Table	Create Table
 t3	CREATE TABLE `t3` (
@@ -1340,6 +1342,7 @@ t3	CREATE TABLE `t3` (
   `a` varbinary(510) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 DROP TABLES t1,t2,t3;
+SET @@global.max_allowed_packet:= @tmp_max;
 create table t1 ( id int not null auto_increment, primary key (id), col1 int);
 insert into t1 (col1) values (2),(3),(4),(5),(6);
 select 99 union all select id from t1 order by 1;
diff --git a/mysql-test/suite/pbxt/r/view_grant.result b/mysql-test/suite/pbxt/r/view_grant.result
index 0847967eb87..5e2744c2933 100644
--- a/mysql-test/suite/pbxt/r/view_grant.result
+++ b/mysql-test/suite/pbxt/r/view_grant.result
@@ -28,7 +28,7 @@ create view v2 as select * from mysqltest.t2;
 ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
 show create view v1;
 View	Create View	character_set_client	collation_connection
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
 grant create view,drop,select on test.* to mysqltest_1@localhost;
 use test;
 alter view v1 as select * from mysqltest.t1;
@@ -309,7 +309,7 @@ grant create view,select on test.* to mysqltest_1@localhost;
 create view v1 as select * from mysqltest.t1;
 show create view v1;
 View	Create View	character_set_client	collation_connection
-v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1`	latin1	latin1_swedish_ci
 revoke select on mysqltest.t1 from mysqltest_1@localhost;
 select * from v1;
 ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
diff --git a/mysql-test/suite/pbxt/t/auto_increment.test b/mysql-test/suite/pbxt/t/auto_increment.test
index 1819e0cba1f..453d4d7658d 100644
--- a/mysql-test/suite/pbxt/t/auto_increment.test
+++ b/mysql-test/suite/pbxt/t/auto_increment.test
@@ -150,7 +150,6 @@ delete from t1 where a=0;
 update t1 set a=0 where b=5;
 select * from t1 order by b;
 delete from t1 where a=0;
---error 1048
 update t1 set a=NULL where b=6;
 update t1 set a=300 where b=7;
 SET SQL_MODE='';
@@ -166,7 +165,6 @@ delete from t1 where a=0;
 update t1 set a=0 where b=12;
 select * from t1 order by b;
 delete from t1 where a=0;
---error 1048
 update t1 set a=NULL where b=13;
 update t1 set a=500 where b=14;
 select * from t1 order by b;
diff --git a/mysql-test/suite/pbxt/t/delete.test b/mysql-test/suite/pbxt/t/delete.test
index d774ed50cd1..913e7df3d3a 100644
--- a/mysql-test/suite/pbxt/t/delete.test
+++ b/mysql-test/suite/pbxt/t/delete.test
@@ -120,13 +120,16 @@ select * from t2;
 delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
 select * from t11;
 select * from t12;
+--error 1242
 delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
 select * from t11;
 select * from t12;
+--error 1062
 insert into t11 values (2, 12);
 -- error 1242
 delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
 select * from t11;
+--error 1242
 delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
 select * from t11;
 drop table t11, t12, t2;
diff --git a/mysql-test/suite/pbxt/t/join_nested.test b/mysql-test/suite/pbxt/t/join_nested.test
index 9a678b5c0f6..e90aa843042 100644
--- a/mysql-test/suite/pbxt/t/join_nested.test
+++ b/mysql-test/suite/pbxt/t/join_nested.test
@@ -546,6 +546,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
 
 CREATE INDEX idx_b ON t8(b);
 
+--sorted_result
 EXPLAIN EXTENDED
 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
        t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
@@ -585,6 +586,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
 CREATE INDEX idx_b ON t1(b);
 CREATE INDEX idx_a ON t0(a);
 
+--sorted_result
 EXPLAIN EXTENDED
 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
        t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
@@ -621,6 +623,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
            (t8.b=t9.b OR t8.c IS NULL) AND
            (t9.a=1); 
 
+--sorted_result
 SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
        t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
   FROM t0,t1
diff --git a/mysql-test/suite/pbxt/t/null.test b/mysql-test/suite/pbxt/t/null.test
index a52e9d85b6c..63281133388 100644
--- a/mysql-test/suite/pbxt/t/null.test
+++ b/mysql-test/suite/pbxt/t/null.test
@@ -61,9 +61,7 @@ drop table t1;
 #
 CREATE TABLE t1 (a varchar(16) NOT NULL default '', b smallint(6) NOT NULL default 0, c datetime NOT NULL default '0000-00-00 00:00:00', d smallint(6) NOT NULL default 0);
 INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
---error 1048
 UPDATE t1 SET d=1/NULL;
---error 1048
 UPDATE t1 SET d=NULL;
 --error 1048
 INSERT INTO t1 (a) values (null);
diff --git a/mysql-test/suite/pbxt/t/pbxt_bugs.test b/mysql-test/suite/pbxt/t/pbxt_bugs.test
index 3976f44267c..b774e9e3034 100644
--- a/mysql-test/suite/pbxt/t/pbxt_bugs.test
+++ b/mysql-test/suite/pbxt/t/pbxt_bugs.test
@@ -926,7 +926,59 @@ LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE
 SELECT * FROM t1 ORDER BY c1;
 DROP TABLE t1;
 
+create table parent (id int primary key);
+create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
+insert into parent values (2), (3), (4);
+insert into child values (3), (4);
+
+--error 1451
+delete ignore from parent;
+--sorted_result
+select * from parent;
+
+drop table child, parent;
+
+# bug 378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
+
+create schema test378222;
+use test378222;
+create table t1 (id int primary key);
+create table t2 (id int primary key);
+alter table t1 add constraint foreign key (id) references t2 (id);
+alter table t2 add constraint foreign key (id) references t1 (id);
+drop schema test378222;
+
+create schema test378222a;
+create schema test378222b;
+create table test378222a.t1 (id int primary key);
+create table test378222b.t2 (id int primary key);
+alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
+alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
+set foreign_key_checks = 1;
+--error 1217
+drop schema test378222a;
+--error 1217
+drop schema test378222b;
+set foreign_key_checks = 0;
+drop schema test378222a;
+drop schema test378222b;
+set foreign_key_checks = 1;
+use test;
+
+# bug 369086: Incosistent/Incorrect Truncate behavior
+CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+INSERT INTO t1 VALUES(null);
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+TRUNCATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+DROP TABLE t1;
+
 --disable_query_log
+
 DROP TABLE t2, t5;
 drop database pbxt;
 --enable_query_log
diff --git a/mysql-test/suite/pbxt/t/rename.test b/mysql-test/suite/pbxt/t/rename.test
index 1cd02ef8a65..670c68f7965 100644
--- a/mysql-test/suite/pbxt/t/rename.test
+++ b/mysql-test/suite/pbxt/t/rename.test
@@ -63,7 +63,28 @@ connection con2;
 # Wait for the the tables to be renamed
 # i.e the query below succeds
 let $query= select * from t2, t4;
-source include/wait_for_query_to_suceed.inc;
+# source include/wait_for_query_to_suceed.inc;
+let $counter= 100;
+
+disable_abort_on_error;
+disable_query_log;
+disable_result_log;
+eval $query;
+while ($mysql_errno)
+{
+  eval $query;
+  sleep 0.1;
+  dec $counter;
+
+  if (!$counter)
+  {
+    die("Waited too long for query to suceed");
+  }
+}
+enable_abort_on_error;
+enable_query_log;
+enable_result_log;
+
 
 show tables;
 
diff --git a/mysql-test/suite/pbxt/t/schema.test b/mysql-test/suite/pbxt/t/schema.test
index a08d9b38935..41e5231f690 100644
--- a/mysql-test/suite/pbxt/t/schema.test
+++ b/mysql-test/suite/pbxt/t/schema.test
@@ -10,5 +10,12 @@ drop database if exists mysqltest1;
 
 create schema foo;
 show create schema foo;
+# force PBXT schema to be created
+create table t1 (id int) engine=pbxt;
 show schemas;
 drop schema foo;
+
+--disable_query_log
+drop table if exists t1;
+drop database pbxt;
+--enable_query_log
diff --git a/mysql-test/suite/pbxt/t/type_enum.test b/mysql-test/suite/pbxt/t/type_enum.test
index 10beff8fdc3..ec562f377f6 100644
--- a/mysql-test/suite/pbxt/t/type_enum.test
+++ b/mysql-test/suite/pbxt/t/type_enum.test
@@ -153,12 +153,19 @@ create table t1(russian_deviant enum('E','F','E
 show create table t1;
 drop table t1;
 
-# ER_WRONG_FIELD_TERMINATORS
---error 1005
+# the following create statement sometimes fails like it would if NO_BACKSLASH_ESCAPES sql mode was on,
+# we check sql mode here
+select @@SESSION.sql_mode;
+select @@GLOBAL.sql_mode;
+
+## ER_WRONG_FIELD_TERMINATORS
+#--error 1005
 create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','	
 
  !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\€','zz亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆辈炒刀犯购患骄坷谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉哙徕沅彐玷殛腱眍镳耱篝貊鼬�'));
 
+drop table t1;
+
 --disable_query_log
 drop database pbxt;
 --enable_query_log
diff --git a/mysql-test/suite/pbxt/t/union.test b/mysql-test/suite/pbxt/t/union.test
index 07add11fe5f..02c73d4bb57 100644
--- a/mysql-test/suite/pbxt/t/union.test
+++ b/mysql-test/suite/pbxt/t/union.test
@@ -802,6 +802,10 @@ drop tables t1,t2,t3;
 # exceeds mediumtext maximum length
 #
 
+SELECT @tmp_max:= @@global.max_allowed_packet;
+SET @@global.max_allowed_packet=25000000;
+# switching connection to allow the new max_allowed_packet take effect
+--connect (newconn, localhost, root,,)
 CREATE TABLE t1 (a mediumtext);
 CREATE TABLE t2 (b varchar(20));
 INSERT INTO t1 VALUES ('a');
@@ -823,6 +827,9 @@ INSERT INTO t1 VALUES ('a');
 CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
 SHOW CREATE TABLE t3;
 DROP TABLES t1,t2,t3;
+--connection default
+SET @@global.max_allowed_packet:= @tmp_max;
+--disconnect newconn
 
 #
 # Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
-- 
2.30.9