From 27762df3048de68e2d8569af7ed1dd3abad5d961 Mon Sep 17 00:00:00 2001
From: Sergei Golubchik <sergii@pisem.net>
Date: Thu, 14 Jul 2011 18:25:05 +0200
Subject: [PATCH] fixing pbxt and oqgraph suites

---
 mysql-test/include/wait_condition.inc         |   1 +
 mysql-test/mysql-test-run.pl                  |   2 +-
 mysql-test/suite/pbxt/r/alter_table.result    | 240 ++---
 mysql-test/suite/pbxt/r/analyze.result        |   4 +-
 .../suite/pbxt/r/bench_count_distinct.result  |   2 +-
 mysql-test/suite/pbxt/r/case.result           |  14 +-
 mysql-test/suite/pbxt/r/cast.result           |  12 +-
 mysql-test/suite/pbxt/r/client_xml.result     |   6 +-
 mysql-test/suite/pbxt/r/compare.result        |   4 +-
 mysql-test/suite/pbxt/r/connect.result        |   3 +
 mysql-test/suite/pbxt/r/constraints.result    |   2 +-
 mysql-test/suite/pbxt/r/create.result         | 867 +++++++++++++++++-
 mysql-test/suite/pbxt/r/date_formats.result   | 172 ++--
 mysql-test/suite/pbxt/r/derived.result        |   8 +-
 mysql-test/suite/pbxt/r/drop.result           |   4 +-
 mysql-test/suite/pbxt/r/flush.result          |   4 +
 mysql-test/suite/pbxt/r/flush_table.result    |  17 +-
 mysql-test/suite/pbxt/r/func_gconcat.result   |  32 +-
 mysql-test/suite/pbxt/r/func_group.result     |  18 +-
 mysql-test/suite/pbxt/r/func_like.result      |   2 +-
 mysql-test/suite/pbxt/r/func_math.result      |  30 +-
 mysql-test/suite/pbxt/r/func_str.result       | 268 +++---
 mysql-test/suite/pbxt/r/grant.result          |  55 +-
 mysql-test/suite/pbxt/r/grant_cache.result    |   2 +
 .../suite/pbxt/r/greedy_optimizer.result      |   2 +
 mysql-test/suite/pbxt/r/group_by.result       | 266 +++++-
 mysql-test/suite/pbxt/r/group_min_max.result  |   4 +-
 mysql-test/suite/pbxt/r/heap.result           |   4 +-
 mysql-test/suite/pbxt/r/heap_btree.result     |   4 +-
 mysql-test/suite/pbxt/r/heap_hash.result      |  32 +-
 mysql-test/suite/pbxt/r/insert.result         |  28 +-
 mysql-test/suite/pbxt/r/join.result           |   6 +-
 mysql-test/suite/pbxt/r/join_outer.result     |  12 +-
 mysql-test/suite/pbxt/r/key.result            |  20 +-
 mysql-test/suite/pbxt/r/key_cache.result      | 322 -------
 mysql-test/suite/pbxt/r/lock.result           |  11 +-
 mysql-test/suite/pbxt/r/lock_multi.result     |  20 +-
 mysql-test/suite/pbxt/r/metadata.result       |   4 +-
 mysql-test/suite/pbxt/r/mysqlshow.result      |  40 +-
 mysql-test/suite/pbxt/r/null.result           |   2 +-
 mysql-test/suite/pbxt/r/null_key.result       |   1 +
 mysql-test/suite/pbxt/r/odbc.result           |   3 +-
 .../suite/pbxt/r/partition_error.result       |  67 +-
 mysql-test/suite/pbxt/r/partition_hash.result |  14 +-
 .../suite/pbxt/r/partition_pruning.result     | 166 ++--
 .../suite/pbxt/r/partition_range.result       |  20 +-
 mysql-test/suite/pbxt/r/pbxt_bugs.result      |  32 +-
 mysql-test/suite/pbxt/r/pbxt_my_fail2.result  |   2 +
 .../suite/pbxt/r/pbxt_transactions.result     |   4 +
 mysql-test/suite/pbxt/r/ps_1general.result    |  21 +-
 mysql-test/suite/pbxt/r/ps_grant.result       |   3 +-
 mysql-test/suite/pbxt/r/rename.result         |  12 +-
 mysql-test/suite/pbxt/r/schema.result         |   1 +
 mysql-test/suite/pbxt/r/select.result         | 109 ++-
 mysql-test/suite/pbxt/r/select_safe.result    |   4 +
 mysql-test/suite/pbxt/r/status.result         |  12 +-
 mysql-test/suite/pbxt/r/subselect.result      |  35 +-
 mysql-test/suite/pbxt/r/type_binary.result    |   2 +-
 mysql-test/suite/pbxt/r/type_bit.result       |   2 +-
 mysql-test/suite/pbxt/r/type_decimal.result   |  15 +-
 mysql-test/suite/pbxt/r/type_float.result     |  28 +-
 .../suite/pbxt/r/type_newdecimal.result       | 185 ++--
 mysql-test/suite/pbxt/r/type_ranges.result    |  36 +-
 mysql-test/suite/pbxt/r/type_timestamp.result |  26 +-
 mysql-test/suite/pbxt/r/union.result          |  16 +-
 mysql-test/suite/pbxt/r/update.result         |  24 +-
 mysql-test/suite/pbxt/r/user_var.result       |   2 -
 mysql-test/suite/pbxt/r/view_grant.result     |  23 +-
 mysql-test/suite/pbxt/t/constraints.test      |   2 +-
 mysql-test/suite/pbxt/t/create.test           | 606 +++++++++++-
 mysql-test/suite/pbxt/t/date_formats.test     | 152 +--
 mysql-test/suite/pbxt/t/derived.test          |  13 +-
 mysql-test/suite/pbxt/t/drop.test             |   7 +-
 mysql-test/suite/pbxt/t/endspace.test         |   2 +
 mysql-test/suite/pbxt/t/flush.test            |  13 +-
 mysql-test/suite/pbxt/t/flush_table.test      |  25 +-
 mysql-test/suite/pbxt/t/func_str.test         |   2 +-
 mysql-test/suite/pbxt/t/group_by.test         |  85 +-
 mysql-test/suite/pbxt/t/key_cache.test        | 229 -----
 mysql-test/suite/pbxt/t/lock.test             |  11 +-
 mysql-test/suite/pbxt/t/lock_multi.test       | 137 ++-
 mysql-test/suite/pbxt/t/odbc.test             |   2 +
 mysql-test/suite/pbxt/t/partition_error.test  |  90 +-
 mysql-test/suite/pbxt/t/ps_1general.test      |  90 +-
 mysql-test/suite/pbxt/t/ps_grant.test         |   3 +-
 mysql-test/suite/pbxt/t/rename.test           |  54 +-
 mysql-test/suite/pbxt/t/select.test           |  39 +-
 mysql-test/suite/pbxt/t/subselect.test        |   6 -
 mysql-test/suite/pbxt/t/type_decimal.test     |  12 +-
 mysql-test/suite/pbxt/t/type_newdecimal.test  |  13 +-
 mysql-test/suite/pbxt/t/type_timestamp.test   |  13 +-
 mysql-test/suite/pbxt/t/union.test            |   2 +-
 mysql-test/suite/pbxt/t/user_var.test         |   2 -
 mysql-test/suite/pbxt/t/view_grant.test       | 194 ++--
 storage/maria/ha_maria.cc                     |  11 +-
 storage/oqgraph/CMakeLists.txt                |   3 +-
 storage/pbxt/src/ha_pbxt.cc                   |   4 +
 97 files changed, 3147 insertions(+), 2086 deletions(-)
 delete mode 100644 mysql-test/suite/pbxt/r/key_cache.result
 delete mode 100644 mysql-test/suite/pbxt/t/key_cache.test

diff --git a/mysql-test/include/wait_condition.inc b/mysql-test/include/wait_condition.inc
index a41d8080c9b..ac61b76db32 100644
--- a/mysql-test/include/wait_condition.inc
+++ b/mysql-test/include/wait_condition.inc
@@ -54,6 +54,7 @@ while ($wait_counter)
 if (!$success)
 {
   echo Timeout in wait_condition.inc for $wait_condition;
+  show full processlist;
 }
 
 --enable_query_log
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index f1bedacd433..facc97c5aaf 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -162,7 +162,7 @@ our $opt_vs_config = $ENV{'MTR_VS_CONFIG'};
 
 # If you add a new suite, please check TEST_DIRS in Makefile.am.
 #
-my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,perfschema,maria,parts,percona,vcol,oqgraph,sphinx";
+my $DEFAULT_SUITES= "main,sys_vars,binlog,federated,rpl,innodb,perfschema,maria,parts,percona,vcol,oqgraph,sphinx,pbxt";
 my $opt_suites;
 
 our $opt_verbose= 0;  # Verbose output, enable with --verbose
diff --git a/mysql-test/suite/pbxt/r/alter_table.result b/mysql-test/suite/pbxt/r/alter_table.result
index 7f9ad9665fe..f4209ad3944 100644
--- a/mysql-test/suite/pbxt/r/alter_table.result
+++ b/mysql-test/suite/pbxt/r/alter_table.result
@@ -125,24 +125,24 @@ key (n3, n4, n1, n2),
 key (n4, n1, n2, n3) );
 alter table t1 disable keys;
 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	n1	1	n1	A	0	NULL	NULL		BTREE	
-t1	1	n1_2	1	n1	A	0	NULL	NULL		BTREE	
-t1	1	n1_2	2	n2	A	0	NULL	NULL	YES	BTREE	
-t1	1	n1_2	3	n3	A	0	NULL	NULL	YES	BTREE	
-t1	1	n1_2	4	n4	A	0	NULL	NULL	YES	BTREE	
-t1	1	n2	1	n2	A	0	NULL	NULL	YES	BTREE	
-t1	1	n2	2	n3	A	0	NULL	NULL	YES	BTREE	
-t1	1	n2	3	n4	A	0	NULL	NULL	YES	BTREE	
-t1	1	n2	4	n1	A	0	NULL	NULL		BTREE	
-t1	1	n3	1	n3	A	0	NULL	NULL	YES	BTREE	
-t1	1	n3	2	n4	A	0	NULL	NULL	YES	BTREE	
-t1	1	n3	3	n1	A	0	NULL	NULL		BTREE	
-t1	1	n3	4	n2	A	0	NULL	NULL	YES	BTREE	
-t1	1	n4	1	n4	A	0	NULL	NULL	YES	BTREE	
-t1	1	n4	2	n1	A	0	NULL	NULL		BTREE	
-t1	1	n4	3	n2	A	0	NULL	NULL	YES	BTREE	
-t1	1	n4	4	n3	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	n1	1	n1	A	0	NULL	NULL		BTREE		
+t1	1	n1_2	1	n1	A	0	NULL	NULL		BTREE		
+t1	1	n1_2	2	n2	A	0	NULL	NULL	YES	BTREE		
+t1	1	n1_2	3	n3	A	0	NULL	NULL	YES	BTREE		
+t1	1	n1_2	4	n4	A	0	NULL	NULL	YES	BTREE		
+t1	1	n2	1	n2	A	0	NULL	NULL	YES	BTREE		
+t1	1	n2	2	n3	A	0	NULL	NULL	YES	BTREE		
+t1	1	n2	3	n4	A	0	NULL	NULL	YES	BTREE		
+t1	1	n2	4	n1	A	0	NULL	NULL		BTREE		
+t1	1	n3	1	n3	A	0	NULL	NULL	YES	BTREE		
+t1	1	n3	2	n4	A	0	NULL	NULL	YES	BTREE		
+t1	1	n3	3	n1	A	0	NULL	NULL		BTREE		
+t1	1	n3	4	n2	A	0	NULL	NULL	YES	BTREE		
+t1	1	n4	1	n4	A	0	NULL	NULL	YES	BTREE		
+t1	1	n4	2	n1	A	0	NULL	NULL		BTREE		
+t1	1	n4	3	n2	A	0	NULL	NULL	YES	BTREE		
+t1	1	n4	4	n3	A	0	NULL	NULL	YES	BTREE		
 insert into t1 values(10,RAND()*1000,RAND()*1000,RAND());
 insert into t1 values(9,RAND()*1000,RAND()*1000,RAND());
 insert into t1 values(8,RAND()*1000,RAND()*1000,RAND());
@@ -155,24 +155,24 @@ insert into t1 values(2,RAND()*1000,RAND()*1000,RAND());
 insert into t1 values(1,RAND()*1000,RAND()*1000,RAND());
 alter table t1 enable keys;
 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	n1	1	n1	A	10	NULL	NULL		BTREE	
-t1	1	n1_2	1	n1	A	10	NULL	NULL		BTREE	
-t1	1	n1_2	2	n2	A	10	NULL	NULL	YES	BTREE	
-t1	1	n1_2	3	n3	A	10	NULL	NULL	YES	BTREE	
-t1	1	n1_2	4	n4	A	10	NULL	NULL	YES	BTREE	
-t1	1	n2	1	n2	A	10	NULL	NULL	YES	BTREE	
-t1	1	n2	2	n3	A	10	NULL	NULL	YES	BTREE	
-t1	1	n2	3	n4	A	10	NULL	NULL	YES	BTREE	
-t1	1	n2	4	n1	A	10	NULL	NULL		BTREE	
-t1	1	n3	1	n3	A	10	NULL	NULL	YES	BTREE	
-t1	1	n3	2	n4	A	10	NULL	NULL	YES	BTREE	
-t1	1	n3	3	n1	A	10	NULL	NULL		BTREE	
-t1	1	n3	4	n2	A	10	NULL	NULL	YES	BTREE	
-t1	1	n4	1	n4	A	10	NULL	NULL	YES	BTREE	
-t1	1	n4	2	n1	A	10	NULL	NULL		BTREE	
-t1	1	n4	3	n2	A	10	NULL	NULL	YES	BTREE	
-t1	1	n4	4	n3	A	10	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	n1	1	n1	A	10	NULL	NULL		BTREE		
+t1	1	n1_2	1	n1	A	10	NULL	NULL		BTREE		
+t1	1	n1_2	2	n2	A	10	NULL	NULL	YES	BTREE		
+t1	1	n1_2	3	n3	A	10	NULL	NULL	YES	BTREE		
+t1	1	n1_2	4	n4	A	10	NULL	NULL	YES	BTREE		
+t1	1	n2	1	n2	A	10	NULL	NULL	YES	BTREE		
+t1	1	n2	2	n3	A	10	NULL	NULL	YES	BTREE		
+t1	1	n2	3	n4	A	10	NULL	NULL	YES	BTREE		
+t1	1	n2	4	n1	A	10	NULL	NULL		BTREE		
+t1	1	n3	1	n3	A	10	NULL	NULL	YES	BTREE		
+t1	1	n3	2	n4	A	10	NULL	NULL	YES	BTREE		
+t1	1	n3	3	n1	A	10	NULL	NULL		BTREE		
+t1	1	n3	4	n2	A	10	NULL	NULL	YES	BTREE		
+t1	1	n4	1	n4	A	10	NULL	NULL	YES	BTREE		
+t1	1	n4	2	n1	A	10	NULL	NULL		BTREE		
+t1	1	n4	3	n2	A	10	NULL	NULL	YES	BTREE		
+t1	1	n4	4	n3	A	10	NULL	NULL	YES	BTREE		
 drop table t1;
 create table t1 (i int unsigned not null auto_increment primary key);
 alter table t1 rename t2;
@@ -285,18 +285,18 @@ insert into t1 values(1,2), (2,2), (3, 2);
 insert into t1 values(1,1), (2,1), (3, 1);
 alter table t1 add unique (a,b), add key (b);
 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	a	1	a	A	300	NULL	NULL	YES	BTREE	
-t1	0	a	2	b	A	300	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	300	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	300	NULL	NULL	YES	BTREE		
+t1	0	a	2	b	A	300	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	300	NULL	NULL	YES	BTREE		
 analyze table t1;
 Table	Op	Msg_type	Msg_text
 test.t1	analyze	status	OK
 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	a	1	a	A	300	NULL	NULL	YES	BTREE	
-t1	0	a	2	b	A	300	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	300	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	300	NULL	NULL	YES	BTREE		
+t1	0	a	2	b	A	300	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	300	NULL	NULL	YES	BTREE		
 drop table t1;
 CREATE TABLE t1 (i int(10), index(i) );
 ALTER TABLE t1 DISABLE KEYS;
@@ -312,9 +312,9 @@ ALTER TABLE t1 DISABLE KEYS;
 LOCK TABLES t1 WRITE;
 INSERT INTO t1 VALUES ('localhost','root'),('localhost',''),('games','monty');
 SHOW INDEX 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	Host	A	NULL	NULL	NULL		BTREE	
-t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	Host	A	NULL	NULL	NULL		BTREE		
+t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE		
 ALTER TABLE t1 ENABLE KEYS;
 UNLOCK TABLES;
 CHECK TABLES t1;
@@ -329,23 +329,23 @@ KEY  (Host)
 ) ENGINE=MyISAM;
 ALTER TABLE t1 DISABLE KEYS;
 SHOW INDEX 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	Host	A	NULL	NULL	NULL		BTREE	
-t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE	
-t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	Host	A	NULL	NULL	NULL		BTREE		
+t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE		
+t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled	
 LOCK TABLES t1 WRITE;
 INSERT INTO t1 VALUES ('localhost','root'),('localhost','');
 SHOW INDEX 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	Host	A	NULL	NULL	NULL		BTREE	
-t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE	
-t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	Host	A	NULL	NULL	NULL		BTREE		
+t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE		
+t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled	
 ALTER TABLE t1 ENABLE KEYS;
 SHOW INDEX 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	Host	A	NULL	NULL	NULL		BTREE	
-t1	0	PRIMARY	2	User	A	2	NULL	NULL		BTREE	
-t1	1	Host	1	Host	A	1	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	Host	A	NULL	NULL	NULL		BTREE		
+t1	0	PRIMARY	2	User	A	2	NULL	NULL		BTREE		
+t1	1	Host	1	Host	A	1	NULL	NULL		BTREE		
 UNLOCK TABLES;
 CHECK TABLES t1;
 Table	Op	Msg_type	Msg_text
@@ -367,10 +367,10 @@ KEY  (Host)
 LOCK TABLES t1 WRITE;
 ALTER TABLE t1 DISABLE KEYS;
 SHOW INDEX 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	Host	A	NULL	NULL	NULL		BTREE	
-t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE	
-t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	Host	A	NULL	NULL	NULL		BTREE		
+t1	0	PRIMARY	2	User	A	0	NULL	NULL		BTREE		
+t1	1	Host	1	Host	A	NULL	NULL	NULL		BTREE	disabled	
 DROP TABLE t1;
 create table t1 (a int);
 alter table t1 rename to ``;
@@ -544,38 +544,38 @@ drop table t1;
 drop table if exists t1;
 create table t1 (a int, key(a));
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 "this used not to disable the index"
 alter table t1 modify a int, disable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 enable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 modify a bigint, disable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 enable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 add b char(10), disable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 add c decimal(10,2), enable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 "this however did"
 alter table t1 disable keys;
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 desc t1;
 Field	Type	Null	Key	Default	Extra
 a	bigint(20)	YES	MUL	NULL	
@@ -584,83 +584,83 @@ c	decimal(10,2)	YES		NULL
 alter table t1 add d decimal(15,5);
 "The key should still be disabled"
 show indexes 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 drop table t1;
 "Now will test with one unique index"
 create table t1(a int, b char(10), unique(a));
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 enable keys;
 "If no copy on noop change, this won't touch the data file"
 "Unique index, no change"
 alter table t1 modify a int, disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 "Change the type implying data copy"
 "Unique index, no change"
 alter table t1 modify a bigint, disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 modify a bigint;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 alter table t1 modify a int;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
 drop table t1;
 "Now will test with one unique and one non-unique index"
 create table t1(a int, b char(10), unique(a), key(b));
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 alter table t1 disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 alter table t1 enable keys;
 "If no copy on noop change, this won't touch the data file"
 "The non-unique index will be disabled"
 alter table t1 modify a int, disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 alter table t1 enable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 "Change the type implying data copy"
 "The non-unique index will be disabled"
 alter table t1 modify a bigint, disable keys;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 "Change again the type, but leave the indexes as_is"
 alter table t1 modify a int;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 "Try the same. When data is no copied on similar tables, this is noop"
 alter table t1 modify a int;
 show indexes from t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE	
-t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	a	1	a	A	0	NULL	NULL	YES	BTREE		
+t1	1	b	1	b	A	0	NULL	NULL	YES	BTREE		
 drop table t1;
 create database mysqltest;
 create table t1 (c1 int);
@@ -696,12 +696,12 @@ DROP TABLE IF EXISTS bug24219;
 DROP TABLE IF EXISTS bug24219_2;
 CREATE TABLE bug24219 (a INT, INDEX(a));
 SHOW INDEX FROM bug24219;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-bug24219	1	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+bug24219	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 ALTER TABLE bug24219 RENAME TO bug24219_2, DISABLE KEYS;
 SHOW INDEX FROM bug24219_2;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-bug24219_2	1	a	1	a	A	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+bug24219_2	1	a	1	a	A	0	NULL	NULL	YES	BTREE		
 DROP TABLE bug24219_2;
 create table t1 (mycol int(10) not null);
 alter table t1 alter column mycol set default 0;
@@ -881,8 +881,8 @@ Field	Type	Null	Key	Default	Extra
 int_field	int(10) unsigned	NO	MUL	NULL	
 char_field	char(10)	YES		NULL	
 SHOW INDEXES FROM t1;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t1	1	int_field	1	int_field	A	0	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	int_field	1	int_field	A	0	NULL	NULL		BTREE		
 INSERT INTO t1 VALUES (1, "edno"), (1, "edno"), (2, "dve"), (3, "tri"), (5, "pet");
 "Non-copy data change - new frm, but old data and index files"
 ALTER TABLE t1
diff --git a/mysql-test/suite/pbxt/r/analyze.result b/mysql-test/suite/pbxt/r/analyze.result
index d2e7fc29d3a..1a0bb85bb14 100644
--- a/mysql-test/suite/pbxt/r/analyze.result
+++ b/mysql-test/suite/pbxt/r/analyze.result
@@ -55,6 +55,6 @@ analyze table t1;
 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	5	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	a	1	a	A	5	NULL	NULL	YES	BTREE		
 drop table t1;
diff --git a/mysql-test/suite/pbxt/r/bench_count_distinct.result b/mysql-test/suite/pbxt/r/bench_count_distinct.result
index 79e12afd237..fceed69f5db 100644
--- a/mysql-test/suite/pbxt/r/bench_count_distinct.result
+++ b/mysql-test/suite/pbxt/r/bench_count_distinct.result
@@ -5,7 +5,7 @@ count(distinct n)
 100
 explain extended select count(distinct n) from t1;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	SIMPLE	t1	index	NULL	n	4	NULL	200	100.00	Using index
+1	SIMPLE	t1	range	NULL	n	4	NULL	201	99.50	Using index for group-by (scanning)
 Warnings:
 Note	1003	select count(distinct `test`.`t1`.`n`) AS `count(distinct n)` from `test`.`t1`
 drop table t1;
diff --git a/mysql-test/suite/pbxt/r/case.result b/mysql-test/suite/pbxt/r/case.result
index 82485673e33..36cb6b87534 100644
--- a/mysql-test/suite/pbxt/r/case.result
+++ b/mysql-test/suite/pbxt/r/case.result
@@ -101,16 +101,16 @@ Table	Create Table
 t1	CREATE TABLE `t1` (
   `c1` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
   `c2` varchar(1) CHARACTER SET latin1 COLLATE latin1_danish_ci NOT NULL DEFAULT '',
-  `c3` varbinary(1) NOT NULL DEFAULT '',
-  `c4` varbinary(1) NOT NULL DEFAULT '',
-  `c5` varbinary(4) NOT NULL DEFAULT '',
-  `c6` varbinary(4) NOT NULL DEFAULT '',
+  `c3` varchar(1) NOT NULL DEFAULT '',
+  `c4` varchar(1) NOT NULL DEFAULT '',
+  `c5` varchar(4) NOT NULL DEFAULT '',
+  `c6` varchar(4) NOT NULL DEFAULT '',
   `c7` decimal(2,1) NOT NULL DEFAULT '0.0',
   `c8` decimal(2,1) NOT NULL DEFAULT '0.0',
   `c9` decimal(2,1) DEFAULT NULL,
   `c10` double NOT NULL DEFAULT '0',
   `c11` double NOT NULL DEFAULT '0',
-  `c12` varbinary(5) NOT NULL DEFAULT ''
+  `c12` varchar(5) NOT NULL DEFAULT ''
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 DROP TABLE t1;
 SELECT CASE 
@@ -155,8 +155,8 @@ t1	CREATE TABLE `t1` (
   `COALESCE(1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
   `COALESCE('a')` varchar(1) NOT NULL DEFAULT '',
   `COALESCE(1,1.0)` decimal(2,1) NOT NULL DEFAULT '0.0',
-  `COALESCE(1,'1')` varbinary(1) NOT NULL DEFAULT '',
-  `COALESCE(1.1,'1')` varbinary(4) NOT NULL DEFAULT '',
+  `COALESCE(1,'1')` varchar(1) NOT NULL DEFAULT '',
+  `COALESCE(1.1,'1')` varchar(4) NOT NULL DEFAULT '',
   `COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 DROP TABLE t1;
diff --git a/mysql-test/suite/pbxt/r/cast.result b/mysql-test/suite/pbxt/r/cast.result
index bc0c983c8e1..735e2b88582 100644
--- a/mysql-test/suite/pbxt/r/cast.result
+++ b/mysql-test/suite/pbxt/r/cast.result
@@ -342,18 +342,18 @@ INSERT INTO t1 SET f1 = -1.0e+30 ;
 INSERT INTO t1 SET f1 = +1.0e+30 ;
 SELECT f1 AS double_val, CAST(f1 AS SIGNED INT) AS cast_val FROM t1;
 double_val	cast_val
--1e+30	-9223372036854775808
-1e+30	9223372036854775807
+-1e30	-9223372036854775808
+1e30	9223372036854775807
 Warnings:
-Warning	1292	Truncated incorrect INTEGER value: '-1e+30'
-Warning	1292	Truncated incorrect INTEGER value: '1e+30'
+Warning	1292	Truncated incorrect INTEGER value: '-1e30'
+Warning	1292	Truncated incorrect INTEGER value: '1e30'
 DROP TABLE t1;
 select cast('1.2' as decimal(3,2));
 cast('1.2' as decimal(3,2))
 1.20
 select 1e18 * cast('1.2' as decimal(3,2));
 1e18 * cast('1.2' as decimal(3,2))
-1.2e+18
+1.2e18
 select cast(cast('1.2' as decimal(3,2)) as signed);
 cast(cast('1.2' as decimal(3,2)) as signed)
 1
@@ -370,7 +370,7 @@ select cast(s1 as decimal(7,2)) from t1;
 cast(s1 as decimal(7,2))
 99999.99
 Warnings:
-Error	1264	Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
+Warning	1264	Out of range value for column 'cast(s1 as decimal(7,2))' at row 1
 drop table t1;
 CREATE TABLE t1 (v varchar(10), tt tinytext, t text,
 mt mediumtext, lt longtext);
diff --git a/mysql-test/suite/pbxt/r/client_xml.result b/mysql-test/suite/pbxt/r/client_xml.result
index 6a148954fcd..20730ff0a09 100644
--- a/mysql-test/suite/pbxt/r/client_xml.result
+++ b/mysql-test/suite/pbxt/r/client_xml.result
@@ -18,9 +18,9 @@ insert into t1 values (1, 2, 'a&b a<b a>b');
 <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <database name="test">
 	<table_structure name="t1">
-		<field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" />
-		<field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" />
-		<field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" />
+		<field Field="a&amp;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="a&lt;b" Type="int(11)" Null="YES" Key="" Extra="" Comment="" />
+		<field Field="a&gt;b" Type="text" Null="YES" Key="" Extra="" Comment="" />
 	</table_structure>
 	<table_data name="t1">
 	<row>
diff --git a/mysql-test/suite/pbxt/r/compare.result b/mysql-test/suite/pbxt/r/compare.result
index c141b255716..92e95e53db2 100644
--- a/mysql-test/suite/pbxt/r/compare.result
+++ b/mysql-test/suite/pbxt/r/compare.result
@@ -47,9 +47,9 @@ insert into t1 values (0x01,0x01);
 select * from t1 where a=b;
 a	b
 Warnings:
-Warning	1292	Truncated incorrect DOUBLE value: ''
+Warning	1292	Truncated incorrect DOUBLE value: '\x01'
 select * from t1 where a=b and b=0x01;
 a	b
 Warnings:
-Warning	1292	Truncated incorrect DOUBLE value: ''
+Warning	1292	Truncated incorrect DOUBLE value: '\x01'
 drop table if exists t1;
diff --git a/mysql-test/suite/pbxt/r/connect.result b/mysql-test/suite/pbxt/r/connect.result
index c8d048f4d38..e6120137acb 100644
--- a/mysql-test/suite/pbxt/r/connect.result
+++ b/mysql-test/suite/pbxt/r/connect.result
@@ -15,6 +15,7 @@ ndb_binlog_index
 plugin
 proc
 procs_priv
+proxies_priv
 servers
 slow_log
 tables_priv
@@ -48,6 +49,7 @@ ndb_binlog_index
 plugin
 proc
 procs_priv
+proxies_priv
 servers
 slow_log
 tables_priv
@@ -89,6 +91,7 @@ ndb_binlog_index
 plugin
 proc
 procs_priv
+proxies_priv
 servers
 slow_log
 tables_priv
diff --git a/mysql-test/suite/pbxt/r/constraints.result b/mysql-test/suite/pbxt/r/constraints.result
index 344abc454fe..b07bbb06588 100644
--- a/mysql-test/suite/pbxt/r/constraints.result
+++ b/mysql-test/suite/pbxt/r/constraints.result
@@ -3,7 +3,7 @@ create table t1 (a int check (a>0));
 insert into t1 values (1);
 insert into t1 values (0);
 drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
 insert into t1 values (1,0);
 insert into t1 values (0,1);
 drop table t1;
diff --git a/mysql-test/suite/pbxt/r/create.result b/mysql-test/suite/pbxt/r/create.result
index afdbf318195..ae4e04dd562 100644
--- a/mysql-test/suite/pbxt/r/create.result
+++ b/mysql-test/suite/pbxt/r/create.result
@@ -1,5 +1,6 @@
 drop table if exists t1,t2,t3,t4,t5;
 drop database if exists mysqltest;
+drop view if exists v1;
 create table t1 (b char(0));
 insert into t1 values (""),(null);
 select * from t1;
@@ -99,6 +100,14 @@ create table t1 (`` int);
 ERROR 42000: Incorrect column name ''
 create table t1 (i int, index `` (i));
 ERROR 42000: Incorrect index name ''
+create table t1 (i int);
+lock tables t1 read;
+create table t2 (j int);
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+create temporary table t2 (j int);
+drop temporary table t2;
+unlock tables;
+drop table t1;
 create table t1 (a int auto_increment not null primary key, B CHAR(20));
 insert into t1 (b) values ("hello"),("my"),("world");
 create table t2 (key (b)) select * from t1;
@@ -228,7 +237,7 @@ t1	CREATE TABLE `t1` (
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
 drop table t1;
 SET SESSION storage_engine="gemini";
-ERROR 42000: Unknown table engine 'gemini'
+ERROR 42000: Unknown storage engine 'gemini'
 SELECT @@storage_engine;
 @@storage_engine
 MEMORY
@@ -256,15 +265,14 @@ create table if not exists t1 select 1,2;
 Warnings:
 Note	1050	Table 't1' already exists
 create table if not exists t1 select 1,2,3,4;
-ERROR 21S01: Column count doesn't match value count at row 1
+Warnings:
+Note	1050	Table 't1' already exists
 create table if not exists t1 select 1;
 Warnings:
 Note	1050	Table 't1' already exists
 select * from t1;
 1	2	3
 1	2	3
-0	1	2
-0	0	1
 drop table t1;
 flush status;
 create table t1 (a int not null, b int, primary key (a));
@@ -272,28 +280,21 @@ insert into t1 values (1,1);
 create table if not exists t1 select 2;
 Warnings:
 Note	1050	Table 't1' already exists
-Warning	1364	Field 'a' doesn't have a default value
 select * from t1;
 a	b
 1	1
-0	2
 create table if not exists t1 select 3 as 'a',4 as 'b';
 Warnings:
 Note	1050	Table 't1' already exists
-create table if not exists t1 select 3 as 'a',3 as 'b';
-ERROR 23000: Duplicate entry '3' for key 'PRIMARY'
 show warnings;
 Level	Code	Message
 Note	1050	Table 't1' already exists
-Error	1062	Duplicate entry '3' for key 'PRIMARY'
 show status like "Opened_tables";
 Variable_name	Value
 Opened_tables	3
 select * from t1;
 a	b
 1	1
-0	2
-3	4
 drop table t1;
 create table `t1 `(a int);
 ERROR 42000: Incorrect table name 't1 '
@@ -348,7 +349,6 @@ select * from t3;
 id	name
 drop table t2, t3;
 create database mysqltest;
-alter table t1;
 create table mysqltest.t3 like t1;
 create temporary table t3 like mysqltest.t3;
 show create table t3;
@@ -378,6 +378,17 @@ ERROR 42S01: Table 't3' already exists
 drop table t1, t2, t3;
 drop table t3;
 drop database mysqltest;
+create table t1 (i int);
+create table t2 (j int);
+lock tables t1 read;
+create table t3 like t1;
+ERROR HY000: Table 't3' was not locked with LOCK TABLES
+create temporary table t3 like t1;
+drop temporary table t3;
+create temporary table t3 like t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+drop tables t1, t2;
 SET SESSION storage_engine="heap";
 SELECT @@storage_engine;
 @@storage_engine
@@ -390,7 +401,7 @@ t1	CREATE TABLE `t1` (
 ) ENGINE=MEMORY DEFAULT CHARSET=latin1
 drop table t1;
 SET SESSION storage_engine="gemini";
-ERROR 42000: Unknown table engine 'gemini'
+ERROR 42000: Unknown storage engine 'gemini'
 SELECT @@storage_engine;
 @@storage_engine
 MEMORY
@@ -439,7 +450,7 @@ explain t2;
 Field	Type	Null	Key	Default	Extra
 a	int(11)	YES		NULL	
 b	bigint(11)	NO		0	
-c	bigint(11) unsigned	NO		0	
+c	bigint(10) unsigned	NO		0	
 d	date	YES		NULL	
 e	varchar(1)	NO			
 f	datetime	YES		NULL	
@@ -458,7 +469,7 @@ Table	Create Table
 t2	CREATE TABLE `t2` (
   `ifnull(a,a)` tinyint(4) DEFAULT NULL,
   `ifnull(b,b)` smallint(6) DEFAULT NULL,
-  `ifnull(c,c)` mediumint(8) DEFAULT NULL,
+  `ifnull(c,c)` mediumint(9) DEFAULT NULL,
   `ifnull(d,d)` int(11) DEFAULT NULL,
   `ifnull(e,e)` bigint(20) DEFAULT NULL,
   `ifnull(f,f)` float(3,2) DEFAULT NULL,
@@ -593,7 +604,7 @@ b
 drop table t1,t2;
 create table t1 (a int);
 create table t1 select * from t1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR 42S01: Table 't1' already exists
 create table t2 union = (t1) select * from t1;
 ERROR HY000: 'test.t2' is not BASE TABLE
 flush tables with read lock;
@@ -783,8 +794,815 @@ t1	CREATE TABLE `t1` (
   `i` int(11) DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
 drop table t1;
+create table t1 select * from t2;
+ERROR 42S02: Table 'test.t2' doesn't exist
+create table t1 select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
+create table t1 (primary key(a)) select "b" as b;
+ERROR 42000: Key column 'a' doesn't exist in table
+create table t1 (a int);
+create table if not exists t1 select 1 as a, 2 as b;
+Warnings:
+Note	1050	Table 't1' already exists
+drop table t1;
+create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+create table t1 (i int);
+create table t1 select 1 as i;
+ERROR 42S01: Table 't1' already exists
+create table if not exists t1 select 1 as i;
+Warnings:
+Note	1050	Table 't1' already exists
+select * from t1;
+i
+create table if not exists t1 select * from t1;
+Warnings:
+Note	1050	Table 't1' already exists
+select * from t1;
+i
+drop table t1;
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+ERROR HY000: Illegal mix of collations (latin1_swedish_ci,EXPLICIT) and (latin1_bin,EXPLICIT) for operation 'coalesce'
+create temporary table t1 (j int);
+create table if not exists t1 select 1;
+select * from t1;
+j
+drop temporary table t1;
+select * from t1;
+1
+1
+drop table t1;
+create table t1 (i int);
+insert into t1 values (1), (2);
+lock tables t1 read;
+create table t2 select * from t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+create table if not exists t2 select * from t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+create table t2 (j int);
+lock tables t1 read;
+create table t2 select * from t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+create table if not exists t2 select * from t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+lock table t1 read, t2 read;
+create table t2 select * from t1;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+create table if not exists t2 select * from t1;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+unlock tables;
+lock table t1 read, t2 write;
+create table t2 select * from t1;
+ERROR 42S01: Table 't2' already exists
+create table if not exists t2 select * from t1;
+Warnings:
+Note	1050	Table 't2' already exists
+select * from t1;
+i
+1
+2
+unlock tables;
+drop table t2;
+lock tables t1 read;
+create temporary table t2 select * from t1;
+create temporary table if not exists t2 select * from t1;
+Warnings:
+Note	1050	Table 't2' already exists
+select * from t2;
+i
+1
+2
+unlock tables;
+drop table t1, t2;
 create table t1 (upgrade int);
 drop table t1;
+create table t1 (
+c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
+c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
+key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
+);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  `c4` int(11) DEFAULT NULL,
+  `c5` int(11) DEFAULT NULL,
+  `c6` int(11) DEFAULT NULL,
+  `c7` int(11) DEFAULT NULL,
+  `c8` int(11) DEFAULT NULL,
+  `c9` int(11) DEFAULT NULL,
+  `c10` int(11) DEFAULT NULL,
+  `c11` int(11) DEFAULT NULL,
+  `c12` int(11) DEFAULT NULL,
+  `c13` int(11) DEFAULT NULL,
+  `c14` int(11) DEFAULT NULL,
+  `c15` int(11) DEFAULT NULL,
+  `c16` int(11) DEFAULT NULL,
+  KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
+) ENGINE=PBXT DEFAULT CHARSET=latin1
+flush tables;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  `c4` int(11) DEFAULT NULL,
+  `c5` int(11) DEFAULT NULL,
+  `c6` int(11) DEFAULT NULL,
+  `c7` int(11) DEFAULT NULL,
+  `c8` int(11) DEFAULT NULL,
+  `c9` int(11) DEFAULT NULL,
+  `c10` int(11) DEFAULT NULL,
+  `c11` int(11) DEFAULT NULL,
+  `c12` int(11) DEFAULT NULL,
+  `c13` int(11) DEFAULT NULL,
+  `c14` int(11) DEFAULT NULL,
+  `c15` int(11) DEFAULT NULL,
+  `c16` int(11) DEFAULT NULL,
+  KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
+) ENGINE=PBXT DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, 
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
+alter table t1
+add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  `c4` int(11) DEFAULT NULL,
+  `c5` int(11) DEFAULT NULL,
+  `c6` int(11) DEFAULT NULL,
+  `c7` int(11) DEFAULT NULL,
+  `c8` int(11) DEFAULT NULL,
+  `c9` int(11) DEFAULT NULL,
+  `c10` int(11) DEFAULT NULL,
+  `c11` int(11) DEFAULT NULL,
+  `c12` int(11) DEFAULT NULL,
+  `c13` int(11) DEFAULT NULL,
+  `c14` int(11) DEFAULT NULL,
+  `c15` int(11) DEFAULT NULL,
+  `c16` int(11) DEFAULT NULL,
+  KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
+) ENGINE=PBXT DEFAULT CHARSET=latin1
+flush tables;
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  `c4` int(11) DEFAULT NULL,
+  `c5` int(11) DEFAULT NULL,
+  `c6` int(11) DEFAULT NULL,
+  `c7` int(11) DEFAULT NULL,
+  `c8` int(11) DEFAULT NULL,
+  `c9` int(11) DEFAULT NULL,
+  `c10` int(11) DEFAULT NULL,
+  `c11` int(11) DEFAULT NULL,
+  `c12` int(11) DEFAULT NULL,
+  `c13` int(11) DEFAULT NULL,
+  `c14` int(11) DEFAULT NULL,
+  `c15` int(11) DEFAULT NULL,
+  `c16` int(11) DEFAULT NULL,
+  KEY `a001_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a002_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a003_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a004_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a005_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a006_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a007_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a008_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a009_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a010_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a011_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a012_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a013_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a014_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a015_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a016_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a017_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a018_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a019_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a020_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a021_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a022_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a023_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a024_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a025_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a026_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a027_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a028_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a029_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a030_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a031_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a032_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a033_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a034_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a035_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a036_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a037_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a038_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a039_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a040_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a041_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a042_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a043_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a044_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a045_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a046_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a047_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a048_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a049_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a050_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a051_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a052_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a053_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a054_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a055_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a056_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a057_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a058_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a059_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a060_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a061_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a062_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a063_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`),
+  KEY `a064_long_123456789_123456789_123456789_123456789_123456789_1234` (`c1`,`c2`,`c3`,`c4`,`c5`,`c6`,`c7`,`c8`,`c9`,`c10`,`c11`,`c12`,`c13`,`c14`,`c15`,`c16`)
+) ENGINE=PBXT DEFAULT CHARSET=latin1
+alter table t1 add key 
+a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+ERROR 42000: Too many keys specified; max 64 keys allowed
+drop table t1;
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, 
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, 
+c16 int, c17 int, c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int, c33 int);
+alter table t1 add key i1 (
+c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32,c33);
+ERROR 42000: Too many key parts specified; max 32 parts allowed
+alter table t1 add key 
+a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
+ERROR 42000: Identifier name 'a001_long_123456789_123456789_123456789_123456789_123456789_12345' is too long
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  `c3` int(11) DEFAULT NULL,
+  `c4` int(11) DEFAULT NULL,
+  `c5` int(11) DEFAULT NULL,
+  `c6` int(11) DEFAULT NULL,
+  `c7` int(11) DEFAULT NULL,
+  `c8` int(11) DEFAULT NULL,
+  `c9` int(11) DEFAULT NULL,
+  `c10` int(11) DEFAULT NULL,
+  `c11` int(11) DEFAULT NULL,
+  `c12` int(11) DEFAULT NULL,
+  `c13` int(11) DEFAULT NULL,
+  `c14` int(11) DEFAULT NULL,
+  `c15` int(11) DEFAULT NULL,
+  `c16` int(11) DEFAULT NULL,
+  `c17` int(11) DEFAULT NULL,
+  `c18` int(11) DEFAULT NULL,
+  `c19` int(11) DEFAULT NULL,
+  `c20` int(11) DEFAULT NULL,
+  `c21` int(11) DEFAULT NULL,
+  `c22` int(11) DEFAULT NULL,
+  `c23` int(11) DEFAULT NULL,
+  `c24` int(11) DEFAULT NULL,
+  `c25` int(11) DEFAULT NULL,
+  `c26` int(11) DEFAULT NULL,
+  `c27` int(11) DEFAULT NULL,
+  `c28` int(11) DEFAULT NULL,
+  `c29` int(11) DEFAULT NULL,
+  `c30` int(11) DEFAULT NULL,
+  `c31` int(11) DEFAULT NULL,
+  `c32` int(11) DEFAULT NULL,
+  `c33` int(11) DEFAULT NULL
+) ENGINE=PBXT DEFAULT CHARSET=latin1
+drop table t1;
+
+Bug #26104 Bug on foreign key class constructor
+
+Check that ref_columns is initalized correctly in the constructor
+and semantic checks in mysql_prepare_table work.
+
+We do not need a storage engine that supports foreign keys
+for this test, as the checks are purely syntax-based, and the
+syntax is supported for all engines.
+
+drop table if exists t1,t2;
+create table t1(a int not null, b int not null, primary key (a, b));
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+ERROR 42000: Incorrect foreign key definition for 'fk_bug26104': Key reference and table reference don't match
+drop table t1;
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+Variable_name	Value
+Handler_read_first	0
+Handler_read_key	0
+Handler_read_last	0
+Handler_read_next	0
+Handler_read_prev	0
+Handler_read_rnd	6
+Handler_read_rnd_next	7
+drop table t1,t2;
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
+DROP TABLE t1;
+CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
+DROP TABLE t1;
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	c1	1	c1	NULL	0	NULL	NULL	YES	HASH		
+DROP TABLE t1;
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	1	c1	1	c1	A	NULL	NULL	NULL	YES	BTREE		
+DROP TABLE t1;
+create user mysqltest_1@'test@test';
+ERROR HY000: Malformed hostname (illegal symbol: '@')
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
+INSERT IGNORE INTO t1 (b) VALUES (5);
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+INSERT INTO t2 SELECT a FROM t1;
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+DROP TABLE t1, t2;
+#
+# BUG#46384 - mysqld segfault when trying to create table with same 
+#             name as existing view
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (1),(2),(3);
+CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
+CREATE TABLE v1 AS SELECT * FROM t1;
+ERROR 42S01: Table 'v1' already exists
+DROP VIEW v1;
+DROP TABLE t1,t2;
+End of 5.0 tests
 CREATE TABLE t1 (a int, b int);
 insert into t1 values (1,1),(1,2);
 CREATE TABLE t2 (primary key (a)) select * from t1;
@@ -798,7 +1616,7 @@ drop table if exists t2;
 Warnings:
 Note	1051	Unknown table 't2'
 CREATE TABLE t2 (a int, b int, primary key (a));
-CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+INSERT INTO t2 select * from t1;
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 SELECT * from t2;
 a	b
@@ -809,12 +1627,7 @@ SELECT * from t2;
 a	b
 drop table t2;
 CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
-CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
-ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
-SELECT * from t2;
-a	b
-TRUNCATE table t2;
-INSERT INTO t2 select * from t1;
+INSERT INTO t2 SELECT * FROM t1;
 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
 SELECT * from t2;
 a	b
@@ -823,14 +1636,6 @@ CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
 DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
 ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
-RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' at line 1
-RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' at line 1
-create database mysqltest;
-RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' at line 1
-drop database mysqltest;
 USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
 ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
 SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
diff --git a/mysql-test/suite/pbxt/r/date_formats.result b/mysql-test/suite/pbxt/r/date_formats.result
index 808c84d7c13..aaee13c63f6 100644
--- a/mysql-test/suite/pbxt/r/date_formats.result
+++ b/mysql-test/suite/pbxt/r/date_formats.result
@@ -1,82 +1,20 @@
 drop table if exists t1;
-SHOW GLOBAL VARIABLES LIKE "%_format%";
-Variable_name	Value
-binlog_format	<format>
-date_format	%Y-%m-%d
-datetime_format	%Y-%m-%d %H:%i:%s
-default_week_format	0
-time_format	%H:%i:%s
-SHOW SESSION VARIABLES LIKE "%_format%";
-Variable_name	Value
-binlog_format	<format>
-date_format	%Y-%m-%d
-datetime_format	%Y-%m-%d %H:%i:%s
-default_week_format	0
-time_format	%H:%i:%s
-SET time_format='%H%i%s';
-SET time_format='%H:%i:%s.%f';
-SET time_format='%h-%i-%s.%f%p';
-SET time_format='%h:%i:%s.%f %p';
-SET time_format='%h:%i:%s%p';
-SET date_format='%Y%m%d';
-SET date_format='%Y.%m.%d';
-SET date_format='%d.%m.%Y';
-SET date_format='%m-%d-%Y';
-set datetime_format= '%Y%m%d%H%i%s';
-set datetime_format= '%Y-%m-%d %H:%i:%s';
-set datetime_format= '%m-%d-%y %H:%i:%s.%f';
-set datetime_format= '%d-%m-%Y %h:%i:%s%p';
-set datetime_format= '%H:%i:%s %Y-%m-%d';
-set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
-set datetime_format= '%h:%i:%s %p %Y-%m-%d';
-set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
-SHOW SESSION VARIABLES LIKE "%format";
-Variable_name	Value
-binlog_format	<format>
-date_format	%m-%d-%Y
-datetime_format	%h:%i:%s.%f %p %Y-%m-%d
-default_week_format	0
-time_format	%h:%i:%s%p
-SET time_format='%h:%i:%s';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s'
-SET time_format='%H %i:%s';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H %i:%s'
-SET time_format='%H::%i:%s';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H::%i:%s'
-SET time_format='%H:%i:%s%f';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%f'
-SET time_format='%H:%i.%f:%s';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i.%f:%s'
-SET time_format='%H:%i:%s%p';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i:%s%p'
-SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%h:%i:%s.%f %p %Y-%m-%d'
-SET time_format='%H%i%s.%f';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H%i%s.%f'
-SET time_format='%H:%i-%s.%f';
-ERROR 42000: Variable 'time_format' can't be set to the value of '%H:%i-%s.%f'
-SET date_format='%d.%m.%d';
-ERROR 42000: Variable 'date_format' can't be set to the value of '%d.%m.%d'
-SET datetime_format='%h.%m.%y %d.%i.%s';
-ERROR 42000: Variable 'datetime_format' can't be set to the value of '%h.%m.%y %d.%i.%s'
-set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
-ERROR 42000: Variable 'datetime_format' can't be set to the value of '%H:%i:%s.%f %p %Y-%m-%d'
-set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
-SET SESSION datetime_format=default;
-select @@global.datetime_format, @@session.datetime_format;
-@@global.datetime_format	@@session.datetime_format
-%H:%i:%s %Y-%m-%d	%H:%i:%s %Y-%m-%d
-SET GLOBAL datetime_format=default;
-SET SESSION datetime_format=default;
-select @@global.datetime_format, @@session.datetime_format;
-@@global.datetime_format	@@session.datetime_format
-%Y-%m-%d %H:%i:%s	%Y-%m-%d %H:%i:%s
-SET GLOBAL date_format=default;
-SET GLOBAL time_format=default;
-SET GLOBAL datetime_format=default;
-SET time_format=default;
-SET date_format=default;
-SET datetime_format=default;
+SELECT variable_name, variable_value
+FROM information_schema.global_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+variable_name	variable_value
+DATETIME_FORMAT	%Y-%m-%d %H:%i:%s
+DATE_FORMAT	%Y-%m-%d
+TIME_FORMAT	%H:%i:%s
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
+variable_name	variable_value
+DATETIME_FORMAT	%Y-%m-%d %H:%i:%s
+DATE_FORMAT	%Y-%m-%d
+TIME_FORMAT	%H:%i:%s
 select str_to_date(concat('15-01-2001',' 2:59:58.999'),
 concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
 str_to_date(concat('15-01-2001',' 2:59:58.999'),
@@ -86,11 +24,13 @@ select STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T');
 STR_TO_DATE('2004.12.12 22.30.61','%Y.%m.%d %T')
 NULL
 Warnings:
-Error	1411	Incorrect time value: '22.30.61' for function str_to_date
+Warning	1411	Incorrect time value: '22.30.61' for function str_to_date
 create table t1 (date char(30), format char(30) not null);
 insert into t1 values
 ('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
 ('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456',   '%Y-%m-%d %H:%i:%S.%#'),
 ('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
 ('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
 ('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
@@ -122,6 +62,8 @@ select date,format,str_to_date(date, format) as str_to_date from t1;
 date	format	str_to_date
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	2003-01-02 10:11:12
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	0003-01-02 08:11:02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	2003-01-02 22:11:12
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	2003-01-02 01:11:12.123450
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	2003-01-02 02:11:12.123450
@@ -153,6 +95,8 @@ select date,format,concat('',str_to_date(date, format)) as con from t1;
 date	format	con
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	2003-01-02 10:11:12
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	0003-01-02 08:11:02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	2003-01-02 22:11:12
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	2003-01-02 01:11:12.123450
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	2003-01-02 02:11:12.123450
@@ -184,6 +128,8 @@ select date,format,cast(str_to_date(date, format) as datetime) as datetime from
 date	format	datetime
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	2003-01-02 10:11:12
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	0003-01-02 08:11:02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	2003-01-02 08:11:02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	2003-01-02 22:11:12
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	2003-01-02 01:11:12.123450
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	2003-01-02 02:11:12.123450
@@ -215,6 +161,8 @@ select date,format,DATE(str_to_date(date, format)) as date2 from t1;
 date	format	date2
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	2003-01-02
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	2003-01-02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	0003-01-02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	2003-01-02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	2003-01-02
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	2003-01-02
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	2003-01-02
@@ -246,6 +194,8 @@ select date,format,TIME(str_to_date(date, format)) as time from t1;
 date	format	time
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	10:11:12
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	08:11:02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	08:11:02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	08:11:02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	22:11:12
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	01:11:12.123450
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	02:11:12.123450
@@ -277,6 +227,8 @@ select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
 date	format	time2
 2003-01-02 10:11:12	%Y-%m-%d %H:%i:%S	10:11:12
 03-01-02 8:11:2.123456	%y-%m-%d %H:%i:%S.%#	08:11:02
+0003-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	08:11:02
+03-01-02 8:11:2.123456	%Y-%m-%d %H:%i:%S.%#	08:11:02
 2003-01-02 10:11:12 PM	%Y-%m-%d %h:%i:%S %p	22:11:12
 2003-01-02 01:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f%p	01:11:12.123450
 2003-01-02 02:11:12.12345AM	%Y-%m-%d %h:%i:%S.%f %p	02:11:12.123450
@@ -344,21 +296,21 @@ Tuesday 52 2001	%W %u %x	NULL
 7 53 1998	%w %u %Y	NULL
 NULL	%m.%d.%Y	NULL
 Warnings:
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
-Error	1411	Incorrect datetime value: '10:20:10AM' for function str_to_date
-Error	1411	Incorrect datetime value: '15 Septembei 2001' for function str_to_date
-Error	1411	Incorrect datetime value: '15 Ju 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Sund 15 MA' for function str_to_date
-Error	1411	Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
-Error	1411	Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: '7 53 1998' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
+Warning	1411	Incorrect datetime value: '10:20:10AM' for function str_to_date
+Warning	1411	Incorrect datetime value: '15 Septembei 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: '15 Ju 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Sund 15 MA' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: '7 53 1998' for function str_to_date
 select date,format,concat(str_to_date(date, format),'') as con from t1;
 date	format	con
 2003-01-02 10:11:12 PM	%Y-%m-%d %H:%i:%S %p	NULL
@@ -378,21 +330,21 @@ Tuesday 52 2001	%W %u %x	NULL
 7 53 1998	%w %u %Y	NULL
 NULL	%m.%d.%Y	NULL
 Warnings:
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
-Error	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
-Error	1411	Incorrect datetime value: '10:20:10AM' for function str_to_date
-Error	1411	Incorrect datetime value: '15 Septembei 2001' for function str_to_date
-Error	1411	Incorrect datetime value: '15 Ju 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Sund 15 MA' for function str_to_date
-Error	1411	Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
-Error	1411	Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
-Error	1411	Incorrect datetime value: '7 53 1998' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12.123456' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12AM' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12AN' for function str_to_date
+Warning	1411	Incorrect datetime value: '2003-01-02 10:11:12 PM' for function str_to_date
+Warning	1411	Incorrect datetime value: '10:20:10AM' for function str_to_date
+Warning	1411	Incorrect datetime value: '15 Septembei 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: '15 Ju 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Sund 15 MA' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Thursdai 12 1998' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Sunday 01 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: 'Tuesday 52 2001' for function str_to_date
+Warning	1411	Incorrect datetime value: '7 53 1998' for function str_to_date
 truncate table t1;
 insert into t1 values
 ('10:20:10AM', '%h:%i:%s'),
@@ -432,7 +384,7 @@ select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
 str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'))
 NULL
 Warnings:
-Error	1411	Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
+Warning	1411	Incorrect datetime value: '15-01-2001 12:59:59' for function str_to_date
 explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
 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
diff --git a/mysql-test/suite/pbxt/r/derived.result b/mysql-test/suite/pbxt/r/derived.result
index fb723c45c0f..8ca441b8132 100644
--- a/mysql-test/suite/pbxt/r/derived.result
+++ b/mysql-test/suite/pbxt/r/derived.result
@@ -281,7 +281,7 @@ select * from t1;
 N	M
 3	0
 delete P1.*,p2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS p2 ON P1.N = p2.N;
-ERROR 42S02: Unknown table 'p2' in MULTI DELETE
+ERROR HY000: The target table p2 of the DELETE is not updatable
 delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
 ERROR 42S22: Unknown column 'aaa' in 'field list'
 drop table t1;
@@ -330,10 +330,8 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 2	DERIVED	t2	index	PRIMARY	PRIMARY	4	NULL	2	Using where; Using index
 drop table t2;
 CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY  (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
-insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
-Warnings:
-Note	1265	Data truncated for column 'date_' at row 1
-Note	1265	Data truncated for column 'date_' at row 2
+insert into t1 values (128, 'rozn', 2, curdate(), 10),
+(128, 'rozn', 1, curdate(), 10);
 SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND  grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
 min	max	avg
 10.00	10.00	10
diff --git a/mysql-test/suite/pbxt/r/drop.result b/mysql-test/suite/pbxt/r/drop.result
index 6e90d9a34e4..03db1bf1d9d 100644
--- a/mysql-test/suite/pbxt/r/drop.result
+++ b/mysql-test/suite/pbxt/r/drop.result
@@ -51,6 +51,7 @@ mtr
 mysql
 mysqltest
 pbxt
+performance_schema
 test
 flush tables with read lock;
 drop database mysqltest;
@@ -63,6 +64,7 @@ information_schema
 mtr
 mysql
 pbxt
+performance_schema
 test
 drop database mysqltest;
 ERROR HY000: Can't drop database 'mysqltest'; database doesn't exist
@@ -79,8 +81,8 @@ drop table t1;
 drop database if exists mysqltest;
 drop table if exists t1;
 create table t1 (i int);
-lock tables t1 read;
 create database mysqltest;
+lock tables t1 read;
 drop table t1;
 show open tables;
 drop database mysqltest;
diff --git a/mysql-test/suite/pbxt/r/flush.result b/mysql-test/suite/pbxt/r/flush.result
index 7eb7fd16edb..49da8db5dae 100644
--- a/mysql-test/suite/pbxt/r/flush.result
+++ b/mysql-test/suite/pbxt/r/flush.result
@@ -33,6 +33,9 @@ flush tables with read lock;
 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
 lock table t1 read;
 flush tables with read lock;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+flush tables with read lock;
 lock table t1 write;
 ERROR HY000: Can't execute the query because you have a conflicting read lock
 lock table t1 read;
@@ -46,6 +49,7 @@ flush tables with read lock;
 ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
 lock table t1 read, t2 read, t3 read;
 flush tables with read lock;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
 unlock tables;
 drop table t1, t2, t3;
 create table t1 (c1 int);
diff --git a/mysql-test/suite/pbxt/r/flush_table.result b/mysql-test/suite/pbxt/r/flush_table.result
index 8821bade6b4..2b0ee1cb205 100644
--- a/mysql-test/suite/pbxt/r/flush_table.result
+++ b/mysql-test/suite/pbxt/r/flush_table.result
@@ -3,21 +3,14 @@ create table t1 (a int not null auto_increment primary key);
 insert into t1 values(0);
 lock table t1 read;
 flush table t1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+unlock tables;
+lock table t1 write;
+flush table t1;
 check table t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 unlock tables;
-lock table t1 read;
-lock table t1 read;
-flush table t1;
-select * from t1;
-a
-1
-unlock tables;
-select * from t1;
-a
-1
-unlock tables;
 lock table t1 write;
 lock table t1 read;
 flush table t1;
@@ -26,7 +19,7 @@ a
 1
 unlock tables;
 unlock tables;
-lock table t1 read;
+lock table t1 write;
 lock table t1 write;
 flush table t1;
 select * from t1;
diff --git a/mysql-test/suite/pbxt/r/func_gconcat.result b/mysql-test/suite/pbxt/r/func_gconcat.result
index 2a05198d050..dba612f7b96 100644
--- a/mysql-test/suite/pbxt/r/func_gconcat.result
+++ b/mysql-test/suite/pbxt/r/func_gconcat.result
@@ -153,10 +153,10 @@ grp	group_concat(c)
 4	
 5	NULL
 Warnings:
-Warning	1260	1 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 show warnings;
 Level	Code	Message
-Warning	1260	1 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 set group_concat_max_len = 1024;
 select group_concat(sum(c)) from t1 group by grp;
 ERROR HY000: Invalid use of group function
@@ -380,25 +380,29 @@ group_concat(b)
 bb,c
 BB,C
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 select group_concat(distinct b) from t1 group by a;
 group_concat(distinct b)
 bb,c
 BB,C
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 select group_concat(b order by b) from t1 group by a;
 group_concat(b order by b)
 a,bb
 A,BB
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 3 was cut by GROUP_CONCAT()
+Warning	1260	Row 6 was cut by GROUP_CONCAT()
 select group_concat(distinct b order by b) from t1 group by a;
 group_concat(distinct b order by b)
 a,bb
 A,BB
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 3 was cut by GROUP_CONCAT()
+Warning	1260	Row 6 was cut by GROUP_CONCAT()
 insert into t1 values (1, concat(repeat('1', 300), '2')), 
 (1, concat(repeat('1', 300), '2')), (1, concat(repeat('0', 300), '1')), 
 (2, concat(repeat('1', 300), '2')), (2, concat(repeat('1', 300), '2')), 
@@ -426,25 +430,29 @@ group_concat(b)
 bb,ccc,a,bb,ccc,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
 BB,CCC,A,BB,CCC,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,1111111111111111111111111111111111111111111111111111111111111111111111111111111111
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 7 was cut by GROUP_CONCAT()
+Warning	1260	Row 14 was cut by GROUP_CONCAT()
 select group_concat(distinct b) from t1 group by a;
 group_concat(distinct b)
 bb,ccc,a,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 BB,CCC,A,1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112,00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 5 was cut by GROUP_CONCAT()
+Warning	1260	Row 10 was cut by GROUP_CONCAT()
 select group_concat(b order by b) from t1 group by a;
 group_concat(b order by b)
 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 select group_concat(distinct b order by b) from t1 group by a;
 group_concat(distinct b order by b)
 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001,11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
+Warning	1260	Row 4 was cut by GROUP_CONCAT()
 drop table t1;
 create table t1 (a varchar(255) character set cp1250 collate cp1250_general_ci,
 b varchar(255) character set koi8r);
@@ -617,7 +625,7 @@ insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
 select f2,group_concat(f1) from t1 group by f2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
-def					group_concat(f1)	253	400	1	Y	128	0	63
+def					group_concat(f1)	253	400	1	Y	0	0	8
 f2	group_concat(f1)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2
@@ -729,7 +737,7 @@ insert into t1 values (1,repeat('a',255)),(2,repeat('b',255));
 select f2,group_concat(f1) from t1 group by f2;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def	test	t1	t1	f2	f2	253	255	255	Y	0	0	8
-def					group_concat(f1)	252	1024	1	Y	128	0	63
+def					group_concat(f1)	252	1024	1	Y	0	0	8
 f2	group_concat(f1)
 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa	1
 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb	2
diff --git a/mysql-test/suite/pbxt/r/func_group.result b/mysql-test/suite/pbxt/r/func_group.result
index 339defca9b5..1702b6211e9 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.4831632475944
+3	45.48316324759439
 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;
@@ -891,7 +891,7 @@ select 1e8 * sum(distinct df) from t1;
 330000000
 select 1e8 * min(df) from t1;
 1e8 * min(df)
-110000000
+110000000.00000001
 create table t3 (ifl int);
 insert into t3 values(1), (2);
 select cast(min(ifl) as decimal(5,2)) from t3;
@@ -1186,7 +1186,7 @@ std(s1/s2)
 0.21325764
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.213257635866493
+0.2132576358664934
 select std(e1/e2) from bug22555;
 std(e1/e2)
 0.21325764
@@ -1209,13 +1209,13 @@ i	count(*)	std(e1/e2)
 3	4	0.000000000000000000000000000000
 select round(std(s1/s2), 17) from bug22555;
 round(std(s1/s2), 17)
-0.21325763586649341
+0.21325763586649340
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.213257635866493
+0.2132576358664934
 select round(std(e1/e2), 17) from bug22555;
 round(std(e1/e2), 17)
-0.21325763586649341
+0.21325763586649340
 set div_precision_increment=20;
 select i, count(*), std(s1/s2) from bug22555 group by i order by i;
 i	count(*)	std(s1/s2)
@@ -1234,13 +1234,13 @@ i	count(*)	std(e1/e2)
 3	4	0.000000000000000000000000000000
 select round(std(s1/s2), 17) from bug22555;
 round(std(s1/s2), 17)
-0.21325763586649341
+0.21325763586649340
 select std(o1/o2) from bug22555;
 std(o1/o2)
-0.213257635866493
+0.2132576358664934
 select round(std(e1/e2), 17) from bug22555;
 round(std(e1/e2), 17)
-0.21325763586649341
+0.21325763586649340
 set @@div_precision_increment=@saved_div_precision_increment;
 drop table bug22555;
 create table bug22555 (s smallint, o double, e decimal);
diff --git a/mysql-test/suite/pbxt/r/func_like.result b/mysql-test/suite/pbxt/r/func_like.result
index 9338a76e320..8d0f34f3bda 100644
--- a/mysql-test/suite/pbxt/r/func_like.result
+++ b/mysql-test/suite/pbxt/r/func_like.result
@@ -10,7 +10,7 @@ explain extended select * from t1 where a like concat('abc','%');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	index	a	a	13	NULL	5	20.00	Using where; Using index
 Warnings:
-Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like concat('abc','%'))
+Note	1003	select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` like <cache>(concat('abc','%')))
 select * from t1 where a like "abc%";
 a
 abc
diff --git a/mysql-test/suite/pbxt/r/func_math.result b/mysql-test/suite/pbxt/r/func_math.result
index d4ce452ef51..d2d7ba89b50 100644
--- a/mysql-test/suite/pbxt/r/func_math.result
+++ b/mysql-test/suite/pbxt/r/func_math.result
@@ -44,7 +44,7 @@ Warnings:
 Note	1003	select abs(-(10)) AS `abs(-10)`,sign(-(5)) AS `sign(-5)`,sign(5) AS `sign(5)`,sign(0) AS `sign(0)`
 select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
 log(exp(10))	exp(log(sqrt(10))*2)	log(-1)	log(NULL)	log(1,1)	log(3,9)	log(-1,2)	log(NULL,2)
-10	10	NULL	NULL	NULL	2	NULL	NULL
+10	10.000000000000002	NULL	NULL	NULL	2	NULL	NULL
 explain extended select log(exp(10)),exp(log(sqrt(10))*2),log(-1),log(NULL),log(1,1),log(3,9),log(-1,2),log(NULL,2);
 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
@@ -52,7 +52,7 @@ Warnings:
 Note	1003	select log(exp(10)) AS `log(exp(10))`,exp((log(sqrt(10)) * 2)) AS `exp(log(sqrt(10))*2)`,log(-(1)) AS `log(-1)`,log(NULL) AS `log(NULL)`,log(1,1) AS `log(1,1)`,log(3,9) AS `log(3,9)`,log(-(1),2) AS `log(-1,2)`,log(NULL,2) AS `log(NULL,2)`
 select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(NULL);
 ln(exp(10))	exp(ln(sqrt(10))*2)	ln(-1)	ln(0)	ln(NULL)
-10	10	NULL	NULL	NULL
+10	10.000000000000002	NULL	NULL	NULL
 explain extended select ln(exp(10)),exp(ln(sqrt(10))*2),ln(-1),ln(0),ln(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
@@ -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.90689059560852	NULL	NULL	NULL
+3	3.9068905956085187	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.25527250510331	NULL	NULL	NULL
+2	1.255272505103306	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.0142313651873091	0.028870999839968
+0.014231365187309091	0.028870999839968048
 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
@@ -98,10 +98,10 @@ explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(
 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
 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)`
+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(cot(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.28318530717959
+180	6.283185307179586
 select format(atan(-2, 2), 6);
 format(atan(-2, 2), 6)
 -0.785398
@@ -119,7 +119,7 @@ ACOS(1.0)
 0
 SELECT ASIN(1.0);
 ASIN(1.0)
-1.5707963267949
+1.5707963267948966
 SELECT ACOS(0.2*5.0);
 ACOS(0.2*5.0)
 0
@@ -128,10 +128,10 @@ ACOS(0.5*2.0)
 0
 SELECT ASIN(0.8+0.2);
 ASIN(0.8+0.2)
-1.5707963267949
+1.5707963267948966
 SELECT ASIN(1.2-0.2);
 ASIN(1.2-0.2)
-1.5707963267949
+1.5707963267948966
 select format(4.55, 1), format(4.551, 1);
 format(4.55, 1)	format(4.551, 1)
 4.6	4.6
@@ -228,27 +228,27 @@ select ln(-1);
 ln(-1)
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 select log10(-1);
 log10(-1)
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 select log2(-1);
 log2(-1)
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 select log(2,-1);
 log(2,-1)
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 select log(-2,1);
 log(-2,1)
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 set sql_mode='';
 select round(111,-10);
 round(111,-10)
diff --git a/mysql-test/suite/pbxt/r/func_str.result b/mysql-test/suite/pbxt/r/func_str.result
index 4dc909f42e4..9cf13225635 100644
--- a/mysql-test/suite/pbxt/r/func_str.result
+++ b/mysql-test/suite/pbxt/r/func_str.result
@@ -761,7 +761,7 @@ latin2	latin2_general_ci	2
 drop table t1;
 select charset(null), collation(null), coercibility(null);
 charset(null)	collation(null)	coercibility(null)
-binary	binary	5
+binary	binary	6
 CREATE TABLE t1 (a int, b int);
 CREATE TABLE t2 (a int, b int);
 INSERT INTO t1 VALUES (1,1),(2,2);
@@ -777,7 +777,7 @@ a	b	a	b
 1	1	NULL	NULL
 2	2	2	2
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where coercibility(t2.a) = 2 order by t1.a,t2.a;
+where coercibility(t2.a) = 5 order by t1.a,t2.a;
 a	b	a	b
 1	1	NULL	NULL
 2	2	2	2
@@ -1151,6 +1151,8 @@ INSERT INTO t2 VALUES (0), (1);
 SELECT * FROM t1, t2 WHERE num=str;
 str	num
 notnumber	0
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'notnumber'
 SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
 str	num
 notnumber	0
@@ -1227,13 +1229,13 @@ create table t1 (i int);
 insert into t1 values (1000000000),(1);
 select lpad(i, 7, ' ') as t from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					t	253	7	7	Y	128	31	63
+def					t	253	7	7	Y	0	31	8
 t
 1000000
       1
 select rpad(i, 7, ' ') as t from t1;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
-def					t	253	7	7	Y	128	31	63
+def					t	253	7	7	Y	0	31	8
 t
 1000000
 1      
@@ -1327,10 +1329,10 @@ cast(rtrim(ltrim('  20.06 ')) as decimal(19,2))
 20.06
 select conv("18383815659218730760",10,10) + 0;
 conv("18383815659218730760",10,10) + 0
-1.83838156592187e+19
+1.838381565921873e19
 select "18383815659218730760" + 0;
 "18383815659218730760" + 0
-1.83838156592187e+19
+1.838381565921873e19
 CREATE TABLE t1 (code varchar(10));
 INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
 SELECT ASCII(code), code FROM t1 WHERE code='A12';
@@ -1504,7 +1506,7 @@ select locate('lo','hello',-18446744073709551615);
 locate('lo','hello',-18446744073709551615)
 0
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select locate('lo','hello',18446744073709551615);
 locate('lo','hello',18446744073709551615)
 0
@@ -1512,22 +1514,22 @@ select locate('lo','hello',-18446744073709551616);
 locate('lo','hello',-18446744073709551616)
 0
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select locate('lo','hello',18446744073709551616);
 locate('lo','hello',18446744073709551616)
 0
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select locate('lo','hello',-18446744073709551617);
 locate('lo','hello',-18446744073709551617)
 0
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select locate('lo','hello',18446744073709551617);
 locate('lo','hello',18446744073709551617)
 0
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select left('hello', 10);
 left('hello', 10)
 hello
@@ -1559,8 +1561,8 @@ select left('hello', -18446744073709551615);
 left('hello', -18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select left('hello', 18446744073709551615);
 left('hello', 18446744073709551615)
 hello
@@ -1568,26 +1570,26 @@ select left('hello', -18446744073709551616);
 left('hello', -18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select left('hello', 18446744073709551616);
 left('hello', 18446744073709551616)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select left('hello', -18446744073709551617);
 left('hello', -18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select left('hello', 18446744073709551617);
 left('hello', 18446744073709551617)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select right('hello', 10);
 right('hello', 10)
 hello
@@ -1619,8 +1621,8 @@ select right('hello', -18446744073709551615);
 right('hello', -18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select right('hello', 18446744073709551615);
 right('hello', 18446744073709551615)
 hello
@@ -1628,26 +1630,26 @@ select right('hello', -18446744073709551616);
 right('hello', -18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select right('hello', 18446744073709551616);
 right('hello', 18446744073709551616)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select right('hello', -18446744073709551617);
 right('hello', -18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select right('hello', 18446744073709551617);
 right('hello', 18446744073709551617)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 2, -1);
 substring('hello', 2, -1)
 
@@ -1679,8 +1681,8 @@ select substring('hello', -18446744073709551615, 1);
 substring('hello', -18446744073709551615, 1)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551615, 1);
 substring('hello', 18446744073709551615, 1)
 
@@ -1688,26 +1690,26 @@ select substring('hello', -18446744073709551616, 1);
 substring('hello', -18446744073709551616, 1)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551616, 1);
 substring('hello', 18446744073709551616, 1)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', -18446744073709551617, 1);
 substring('hello', -18446744073709551617, 1)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551617, 1);
 substring('hello', 18446744073709551617, 1)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 1, -1);
 substring('hello', 1, -1)
 
@@ -1733,8 +1735,8 @@ select substring('hello', 1, -18446744073709551615);
 substring('hello', 1, -18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 1, 18446744073709551615);
 substring('hello', 1, 18446744073709551615)
 hello
@@ -1742,26 +1744,26 @@ select substring('hello', 1, -18446744073709551616);
 substring('hello', 1, -18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 1, 18446744073709551616);
 substring('hello', 1, 18446744073709551616)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 1, -18446744073709551617);
 substring('hello', 1, -18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 1, 18446744073709551617);
 substring('hello', 1, 18446744073709551617)
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', -1, -1);
 substring('hello', -1, -1)
 
@@ -1787,10 +1789,10 @@ select substring('hello', -18446744073709551615, -18446744073709551615);
 substring('hello', -18446744073709551615, -18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551615, 18446744073709551615);
 substring('hello', 18446744073709551615, 18446744073709551615)
 
@@ -1798,34 +1800,34 @@ select substring('hello', -18446744073709551616, -18446744073709551616);
 substring('hello', -18446744073709551616, -18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551616, 18446744073709551616);
 substring('hello', 18446744073709551616, 18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', -18446744073709551617, -18446744073709551617);
 substring('hello', -18446744073709551617, -18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select substring('hello', 18446744073709551617, 18446744073709551617);
 substring('hello', 18446744073709551617, 18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', -1, 1, 'hi');
 insert('hello', -1, 1, 'hi')
 hello
@@ -1851,7 +1853,7 @@ select insert('hello', -18446744073709551615, 1, 'hi');
 insert('hello', -18446744073709551615, 1, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551615, 1, 'hi');
 insert('hello', 18446744073709551615, 1, 'hi')
 hello
@@ -1859,22 +1861,22 @@ select insert('hello', -18446744073709551616, 1, 'hi');
 insert('hello', -18446744073709551616, 1, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551616, 1, 'hi');
 insert('hello', 18446744073709551616, 1, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', -18446744073709551617, 1, 'hi');
 insert('hello', -18446744073709551617, 1, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551617, 1, 'hi');
 insert('hello', 18446744073709551617, 1, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 1, -1, 'hi');
 insert('hello', 1, -1, 'hi')
 hi
@@ -1900,7 +1902,7 @@ select insert('hello', 1, -18446744073709551615, 'hi');
 insert('hello', 1, -18446744073709551615, 'hi')
 hi
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 1, 18446744073709551615, 'hi');
 insert('hello', 1, 18446744073709551615, 'hi')
 hi
@@ -1908,22 +1910,22 @@ select insert('hello', 1, -18446744073709551616, 'hi');
 insert('hello', 1, -18446744073709551616, 'hi')
 hi
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 1, 18446744073709551616, 'hi');
 insert('hello', 1, 18446744073709551616, 'hi')
 hi
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 1, -18446744073709551617, 'hi');
 insert('hello', 1, -18446744073709551617, 'hi')
 hi
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 1, 18446744073709551617, 'hi');
 insert('hello', 1, 18446744073709551617, 'hi')
 hi
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', -1, -1, 'hi');
 insert('hello', -1, -1, 'hi')
 hello
@@ -1949,8 +1951,8 @@ select insert('hello', -18446744073709551615, -18446744073709551615, 'hi');
 insert('hello', -18446744073709551615, -18446744073709551615, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551615, 18446744073709551615, 'hi');
 insert('hello', 18446744073709551615, 18446744073709551615, 'hi')
 hello
@@ -1958,26 +1960,26 @@ select insert('hello', -18446744073709551616, -18446744073709551616, 'hi');
 insert('hello', -18446744073709551616, -18446744073709551616, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551616, 18446744073709551616, 'hi');
 insert('hello', 18446744073709551616, 18446744073709551616, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', -18446744073709551617, -18446744073709551617, 'hi');
 insert('hello', -18446744073709551617, -18446744073709551617, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select insert('hello', 18446744073709551617, 18446744073709551617, 'hi');
 insert('hello', 18446744073709551617, 18446744073709551617, 'hi')
 hello
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select repeat('hello', -1);
 repeat('hello', -1)
 
@@ -2009,8 +2011,8 @@ select repeat('hello', -18446744073709551615);
 repeat('hello', -18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select repeat('hello', 18446744073709551615);
 repeat('hello', 18446744073709551615)
 NULL
@@ -2020,27 +2022,27 @@ select repeat('hello', -18446744073709551616);
 repeat('hello', -18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select repeat('hello', 18446744073709551616);
 repeat('hello', 18446744073709551616)
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
 select repeat('hello', -18446744073709551617);
 repeat('hello', -18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select repeat('hello', 18446744073709551617);
 repeat('hello', 18446744073709551617)
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
 select space(-1);
 space(-1)
@@ -2073,8 +2075,8 @@ select space(-18446744073709551615);
 space(-18446744073709551615)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select space(18446744073709551615);
 space(18446744073709551615)
 NULL
@@ -2084,27 +2086,27 @@ select space(-18446744073709551616);
 space(-18446744073709551616)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select space(18446744073709551616);
 space(18446744073709551616)
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
 select space(-18446744073709551617);
 space(-18446744073709551617)
 
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select space(18446744073709551617);
 space(18446744073709551617)
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of repeat() was larger than max_allowed_packet (1048576) - truncated
 select rpad('hello', -1, '1');
 rpad('hello', -1, '1')
@@ -2137,8 +2139,8 @@ select rpad('hello', -18446744073709551615, '1');
 rpad('hello', -18446744073709551615, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select rpad('hello', 18446744073709551615, '1');
 rpad('hello', 18446744073709551615, '1')
 NULL
@@ -2148,27 +2150,27 @@ select rpad('hello', -18446744073709551616, '1');
 rpad('hello', -18446744073709551616, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select rpad('hello', 18446744073709551616, '1');
 rpad('hello', 18446744073709551616, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
 select rpad('hello', -18446744073709551617, '1');
 rpad('hello', -18446744073709551617, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select rpad('hello', 18446744073709551617, '1');
 rpad('hello', 18446744073709551617, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of rpad() was larger than max_allowed_packet (1048576) - truncated
 select lpad('hello', -1, '1');
 lpad('hello', -1, '1')
@@ -2201,8 +2203,8 @@ select lpad('hello', -18446744073709551615, '1');
 lpad('hello', -18446744073709551615, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select lpad('hello', 18446744073709551615, '1');
 lpad('hello', 18446744073709551615, '1')
 NULL
@@ -2212,27 +2214,27 @@ select lpad('hello', -18446744073709551616, '1');
 lpad('hello', -18446744073709551616, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select lpad('hello', 18446744073709551616, '1');
 lpad('hello', 18446744073709551616, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
 select lpad('hello', -18446744073709551617, '1');
 lpad('hello', -18446744073709551617, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select lpad('hello', 18446744073709551617, '1');
 lpad('hello', 18446744073709551617, '1')
 NULL
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1301	Result of lpad() was larger than max_allowed_packet (1048576) - truncated
 SET @orig_sql_mode = @@SQL_MODE;
 SET SQL_MODE=traditional;
@@ -2240,12 +2242,12 @@ SELECT CHAR(0xff,0x8f USING utf8);
 CHAR(0xff,0x8f USING utf8)
 NULL
 Warnings:
-Error	1300	Invalid utf8 character string: 'FF8F'
+Warning	1300	Invalid utf8 character string: 'FF8F'
 SELECT CHAR(0xff,0x8f USING utf8) IS NULL;
 CHAR(0xff,0x8f USING utf8) IS NULL
 1
 Warnings:
-Error	1300	Invalid utf8 character string: 'FF8F'
+Warning	1300	Invalid utf8 character string: 'FF8F'
 SET SQL_MODE=@orig_sql_mode;
 select substring('abc', cast(2 as unsigned int));
 substring('abc', cast(2 as unsigned int))
diff --git a/mysql-test/suite/pbxt/r/grant.result b/mysql-test/suite/pbxt/r/grant.result
index 68395661db3..df518c6bf9d 100644
--- a/mysql-test/suite/pbxt/r/grant.result
+++ b/mysql-test/suite/pbxt/r/grant.result
@@ -11,8 +11,8 @@ GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3
 GRANT SELECT ON `mysqltest`.* TO 'mysqltest_1'@'localhost'
 grant delete on mysqltest.* to mysqltest_1@localhost;
 select * from mysql.user where user="mysqltest_1";
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	auth_string
-localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	SPECIFIED	EDH-RSA-DES-CBC3-SHA			0	0	0	0		
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	authentication_string
+localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	SPECIFIED	EDH-RSA-DES-CBC3-SHA			0	0	0	0		
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' REQUIRE CIPHER 'EDH-RSA-DES-CBC3-SHA'
@@ -42,15 +42,15 @@ delete from mysql.user where user='mysqltest_1';
 flush privileges;
 grant usage on *.* to mysqltest_1@localhost with max_queries_per_hour 10;
 select * from mysql.user where user="mysqltest_1";
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	auth_string
-localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					10	0	0	0		
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	authentication_string
+localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					10	0	0	0		
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10
 grant usage on *.* to mysqltest_1@localhost with max_updates_per_hour 20 max_connections_per_hour 30;
 select * from mysql.user where user="mysqltest_1";
-Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	auth_string
-localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					10	20	30	0		
+Host	User	Password	Select_priv	Insert_priv	Update_priv	Delete_priv	Create_priv	Drop_priv	Reload_priv	Shutdown_priv	Process_priv	File_priv	Grant_priv	References_priv	Index_priv	Alter_priv	Show_db_priv	Super_priv	Create_tmp_table_priv	Lock_tables_priv	Execute_priv	Repl_slave_priv	Repl_client_priv	Create_view_priv	Show_view_priv	Create_routine_priv	Alter_routine_priv	Create_user_priv	Event_priv	Trigger_priv	Create_tablespace_priv	ssl_type	ssl_cipher	x509_issuer	x509_subject	max_questions	max_updates	max_connections	max_user_connections	plugin	authentication_string
+localhost	mysqltest_1		N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N	N					10	20	30	0		
 show grants for mysqltest_1@localhost;
 Grants for mysqltest_1@localhost
 GRANT USAGE ON *.* TO 'mysqltest_1'@'localhost' WITH MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 MAX_CONNECTIONS_PER_HOUR 30
@@ -162,7 +162,7 @@ Warnings:
 Warning	1364	Field 'ssl_cipher' doesn't have a default value
 Warning	1364	Field 'x509_issuer' doesn't have a default value
 Warning	1364	Field 'x509_subject' doesn't have a default value
-Warning	1364	Field 'auth_string' doesn't have a default value
+Warning	1364	Field 'authentication_string' doesn't have a default value
 insert into mysql.db (host, db, user, select_priv) values 
 ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
 alter table mysql.db order by db asc;
@@ -386,10 +386,10 @@ SELECT * FROM INFORMATION_SCHEMA.COLUMN_PRIVILEGES
 WHERE GRANTEE = '''mysqltest_3''@''localhost''' 
 ORDER BY TABLE_NAME,COLUMN_NAME,PRIVILEGE_TYPE;
 GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_3'@'localhost'	NULL	mysqltest_1	t1	a	UPDATE	NO
-'mysqltest_3'@'localhost'	NULL	mysqltest_2	t1	c	SELECT	NO
-'mysqltest_3'@'localhost'	NULL	mysqltest_1	t2	b	SELECT	NO
-'mysqltest_3'@'localhost'	NULL	mysqltest_2	t2	d	UPDATE	NO
+'mysqltest_3'@'localhost'	def	mysqltest_1	t1	a	UPDATE	NO
+'mysqltest_3'@'localhost'	def	mysqltest_2	t1	c	SELECT	NO
+'mysqltest_3'@'localhost'	def	mysqltest_1	t2	b	SELECT	NO
+'mysqltest_3'@'localhost'	def	mysqltest_2	t2	d	UPDATE	NO
 SELECT * FROM INFORMATION_SCHEMA.TABLE_PRIVILEGES
 WHERE GRANTEE = '''mysqltest_3''@''localhost''' 
 ORDER BY TABLE_NAME,PRIVILEGE_TYPE;
@@ -402,7 +402,7 @@ SELECT * from INFORMATION_SCHEMA.USER_PRIVILEGES
 WHERE GRANTEE = '''mysqltest_3''@''localhost'''
  ORDER BY TABLE_CATALOG,PRIVILEGE_TYPE;
 GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_3'@'localhost'	NULL	USAGE	NO
+'mysqltest_3'@'localhost'	def	USAGE	NO
 update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
 ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
 update mysqltest_1.t2, mysqltest_2.t2 set d=20 where d=1;
@@ -472,6 +472,7 @@ Index	Tables	To create or drop indexes
 Insert	Tables	To insert data into tables
 Lock tables	Databases	To use LOCK TABLES (together with SELECT privilege)
 Process	Server Admin	To view the plain text of currently executing queries
+Proxy	Server Admin	To make proxy user possible
 References	Databases,Tables	To have references on tables
 Reload	Server Admin	To reload or refresh tables, logs and privileges
 Replication client	Server Admin	To ask where the slave or master servers are
@@ -482,6 +483,7 @@ Show view	Tables	To see views with SHOW CREATE VIEW
 Shutdown	Server Admin	To shut down the server
 Super	Server Admin	To use KILL thread, SET GLOBAL, CHANGE MASTER, etc.
 Trigger	Tables	To use triggers
+Create tablespace	Server Admin	To create/alter/drop tablespaces
 Update	Tables	To update existing rows
 Usage	Server Admin	No privileges - allow connect only
 create database mysqltest;
@@ -623,16 +625,19 @@ show grants for root@localhost;
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
 GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
 flush privileges;
 show grants for root@localhost;
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
 GRANT SELECT ON `ÂÄ`.* TO 'root'@'localhost'
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
 drop database ÂÄ;
 revoke all privileges on ÂÄ.* from root@localhost;
 show grants for root@localhost;
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
 set names latin1;
 create user mysqltest_7@;
 set password for mysqltest_7@ = password('systpass');
@@ -698,8 +703,8 @@ GRANT SELECT ON `mysqltest`.* TO 'mysqltest_8'@'%'
 select * from  information_schema.schema_privileges
 where grantee like "'mysqltest_8'%";
 GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_8'@'%'	NULL	mysqltest	SELECT	NO
-'mysqltest_8'@''	NULL	mysqltest	SELECT	NO
+'mysqltest_8'@'%'	def	mysqltest	SELECT	NO
+'mysqltest_8'@''	def	mysqltest	SELECT	NO
 select * from t1;
 a
 revoke select on mysqltest.* from mysqltest_8@'';
@@ -750,8 +755,8 @@ GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
 GRANT UPDATE (a) ON `test`.`t1` TO 'mysqltest_8'@'%'
 select * from  information_schema.column_privileges;
 GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	COLUMN_NAME	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_8'@'%'	NULL	test	t1	a	UPDATE	NO
-'mysqltest_8'@''	NULL	test	t1	a	UPDATE	NO
+'mysqltest_8'@'%'	def	test	t1	a	UPDATE	NO
+'mysqltest_8'@''	def	test	t1	a	UPDATE	NO
 select * from t1;
 a
 revoke update (a) on t1 from mysqltest_8@'';
@@ -793,8 +798,8 @@ GRANT USAGE ON *.* TO 'mysqltest_8'@'%'
 GRANT UPDATE ON `test`.`t1` TO 'mysqltest_8'@'%'
 select * from  information_schema.table_privileges;
 GRANTEE	TABLE_CATALOG	TABLE_SCHEMA	TABLE_NAME	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_8'@'%'	NULL	test	t1	UPDATE	NO
-'mysqltest_8'@''	NULL	test	t1	UPDATE	NO
+'mysqltest_8'@'%'	def	test	t1	UPDATE	NO
+'mysqltest_8'@''	def	test	t1	UPDATE	NO
 select * from t1;
 a
 revoke update on t1 from mysqltest_8@'';
@@ -832,9 +837,9 @@ GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
 select * from  information_schema.user_privileges
 where grantee like "'mysqltest_8'%";
 GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_8'@'host8'	NULL	USAGE	NO
-'mysqltest_8'@'%'	NULL	USAGE	NO
-'mysqltest_8'@''	NULL	USAGE	NO
+'mysqltest_8'@'host8'	def	USAGE	NO
+'mysqltest_8'@'%'	def	USAGE	NO
+'mysqltest_8'@''	def	USAGE	NO
 select * from t1;
 a
 flush privileges;
@@ -857,8 +862,8 @@ GRANT ALL PRIVILEGES ON `mysqltest`.* TO 'mysqltest_8'@'%'
 select * from  information_schema.user_privileges
 where grantee like "'mysqltest_8'%";
 GRANTEE	TABLE_CATALOG	PRIVILEGE_TYPE	IS_GRANTABLE
-'mysqltest_8'@'host8'	NULL	USAGE	NO
-'mysqltest_8'@'%'	NULL	USAGE	NO
+'mysqltest_8'@'host8'	def	USAGE	NO
+'mysqltest_8'@'%'	def	USAGE	NO
 drop user mysqltest_8;
 connect(localhost,mysqltest_8,,test,MASTER_PORT,MASTER_SOCKET);
 ERROR 28000: Access denied for user 'mysqltest_8'@'localhost' (using password: NO)
@@ -902,13 +907,13 @@ SHOW CREATE VIEW  mysqltest2.v_ny;
 View	Create View	character_set_client	collation_connection
 v_ny	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `mysqltest2`.`v_ny` AS select `mysqltest2`.`t_nn`.`c1` AS `c1` from `mysqltest2`.`t_nn`	latin1	latin1_swedish_ci
 SHOW CREATE TABLE mysqltest3.t_nn;
-ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
+ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
 SHOW CREATE VIEW  mysqltest3.t_nn;
 ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't_nn'
 SHOW CREATE VIEW  mysqltest3.v_nn;
 ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
 SHOW CREATE TABLE mysqltest3.v_nn;
-ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
+ERROR 42000: SHOW command denied to user 'mysqltest_1'@'localhost' for table 'v_nn'
 SHOW CREATE TABLE mysqltest2.t_nn;
 Table	Create Table
 t_nn	CREATE TABLE `t_nn` (
diff --git a/mysql-test/suite/pbxt/r/grant_cache.result b/mysql-test/suite/pbxt/r/grant_cache.result
index 500965fd646..91b4d43b7dc 100644
--- a/mysql-test/suite/pbxt/r/grant_cache.result
+++ b/mysql-test/suite/pbxt/r/grant_cache.result
@@ -6,9 +6,11 @@ flush status;
 show grants for current_user;
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
 show grants;
 Grants for root@localhost
 GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
+GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION
 create database if not exists mysqltest;
 create table mysqltest.t1 (a int,b int,c int);
 create table mysqltest.t2 (a int,b int,c int);
diff --git a/mysql-test/suite/pbxt/r/greedy_optimizer.result b/mysql-test/suite/pbxt/r/greedy_optimizer.result
index 1d3e42b70fb..eb2d7525910 100644
--- a/mysql-test/suite/pbxt/r/greedy_optimizer.result
+++ b/mysql-test/suite/pbxt/r/greedy_optimizer.result
@@ -115,6 +115,8 @@ select @@optimizer_prune_level;
 @@optimizer_prune_level
 1
 set optimizer_search_depth=63;
+Warnings:
+Warning	1287	'optimizer-search-depth=63' is deprecated and will be removed in a future release. Please use a search depth less than 63 instead
 select @@optimizer_search_depth;
 @@optimizer_search_depth
 63
diff --git a/mysql-test/suite/pbxt/r/group_by.result b/mysql-test/suite/pbxt/r/group_by.result
index c5c9099af0d..7b1a0e4d6bd 100644
--- a/mysql-test/suite/pbxt/r/group_by.result
+++ b/mysql-test/suite/pbxt/r/group_by.result
@@ -107,8 +107,9 @@ SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2
 cid	CONCAT(firstname, ' ', surname)	COUNT(call_id)
 SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
 cid	CONCAT(firstname, ' ', surname)	COUNT(call_id)
-drop table t1,t2;
+drop table t2;
 unlock tables;
+drop table t1;
 CREATE TABLE t1 (
 bug_id mediumint(9) NOT NULL auto_increment,
 groupset bigint(20) DEFAULT '0' NOT NULL,
@@ -933,12 +934,261 @@ b	sum(1)
 18	6
 19	6
 DROP TABLE t1;
-CREATE TABLE t1 (a INT, b INT, KEY(a));
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
-EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2;
+CREATE TABLE t1 (a INT, b INT,
+PRIMARY KEY (a),
+KEY i2(a,b));
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+INSERT INTO t1 SELECT a + 8,b FROM t1;
+INSERT INTO t1 SELECT a + 16,b FROM t1;
+INSERT INTO t1 SELECT a + 32,b FROM t1;
+INSERT INTO t1 SELECT a + 64,b FROM t1;
+INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
+ANALYZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	analyze	status	OK
+EXPLAIN SELECT a FROM t1 WHERE a < 2;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	a	5	NULL	2	
-EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+1	SIMPLE	t1	range	PRIMARY,i2	PRIMARY	4	NULL	1	Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	4	Using temporary; Using filesort
-DROP TABLE t1;
+1	SIMPLE	t1	range	PRIMARY,i2	PRIMARY	4	NULL	1	Using where; Using index
+EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY,i2	PRIMARY	4	NULL	1	Using where; Using index for group-by
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	144	Using index
+SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
+97
+98
+99
+100
+101
+102
+103
+104
+105
+106
+107
+108
+109
+110
+111
+112
+113
+114
+115
+116
+117
+118
+119
+120
+121
+122
+123
+124
+125
+126
+127
+128
+129
+130
+131
+132
+133
+134
+135
+136
+137
+138
+139
+140
+141
+142
+143
+144
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
+IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	i2	9	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 FORCE INDEX (i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	i2	9	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 USE INDEX ();
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 
+FORCE INDEX (PRIMARY) 
+IGNORE INDEX FOR GROUP BY (i2)
+IGNORE INDEX FOR ORDER BY (i2)
+USE INDEX (i2);
+ERROR HY000: Incorrect usage of USE INDEX and FORCE INDEX
+EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX ();
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	i2	9	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 FORCE INDEX ();
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+EXPLAIN SELECT a FROM t1 IGNORE INDEX ();
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
+EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) 
+USE INDEX FOR GROUP BY (i2) GROUP BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	#	NULL	i2	#	NULL	#	#
+EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) 
+FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	NULL	i2	4	NULL	145	Using index for group-by
+EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX ();
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	144	
+EXPLAIN SELECT a FROM t1 
+USE INDEX FOR GROUP BY (i2) 
+USE INDEX FOR ORDER BY (i2)
+USE INDEX FOR JOIN (i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	i2	9	NULL	144	Using index
+EXPLAIN SELECT a FROM t1 
+USE INDEX FOR JOIN (i2) 
+USE INDEX FOR JOIN (i2) 
+USE INDEX FOR JOIN (i2,i2);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	index	NULL	i2	9	NULL	144	Using index
+EXPLAIN SELECT 1 FROM t1 WHERE a IN
+(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	index	PRIMARY,i2	PRIMARY	4	NULL	144	Using index
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	144	Using where; FirstMatch(t1)
+CREATE TABLE t2 (a INT, b INT, KEY(a));
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
+EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	index	NULL	a	5	NULL	2	
+EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	4	Using temporary; Using filesort
+EXPLAIN SELECT 1 FROM t2 WHERE a IN
+(SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t2	index	a	a	5	NULL	4	Using index
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	144	Using where; FirstMatch(t2)
+SHOW VARIABLES LIKE 'old';
+Variable_name	Value
+old	OFF
+SET @@old = off;
+ERROR HY000: Variable 'old' is a read only variable
+DROP TABLE t1, t2;
diff --git a/mysql-test/suite/pbxt/r/group_min_max.result b/mysql-test/suite/pbxt/r/group_min_max.result
index 396451cf8a9..54fe752dae7 100644
--- a/mysql-test/suite/pbxt/r/group_min_max.result
+++ b/mysql-test/suite/pbxt/r/group_min_max.result
@@ -1800,10 +1800,10 @@ b
 a
 explain select count(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	index	NULL	idx_t1_2	147	NULL	128	Using where; Using index
+1	SIMPLE	t1	range	NULL	idx_t1_1	147	NULL	129	Using where; Using index for group-by
 explain select count(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	Extra
-1	SIMPLE	t1	index	NULL	idx_t1_1	163	NULL	128	Using where; Using index
+1	SIMPLE	t1	range	NULL	idx_t1_1	163	NULL	129	Using where; Using index for group-by
 explain extended select count(distinct a1,a2,b) from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	SIMPLE	t1	range	idx_t1_0,idx_t1_1,idx_t1_2	idx_t1_2	65	NULL	32	100.00	Using where; Using index
diff --git a/mysql-test/suite/pbxt/r/heap.result b/mysql-test/suite/pbxt/r/heap.result
index 366258882ad..17088ee01a6 100644
--- a/mysql-test/suite/pbxt/r/heap.result
+++ b/mysql-test/suite/pbxt/r/heap.result
@@ -3,8 +3,8 @@ create table t1 (a int not null,b int not null, primary key (a)) engine=heap com
 insert into t1 values(1,1),(2,2),(3,3),(4,4);
 delete from t1 where a=1 or a=0;
 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	a	NULL	3	NULL	NULL		HASH	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	a	NULL	3	NULL	NULL		HASH		
 select * from t1;
 a	b
 2	2
diff --git a/mysql-test/suite/pbxt/r/heap_btree.result b/mysql-test/suite/pbxt/r/heap_btree.result
index fd789a39d88..6a02fd6ed2e 100644
--- a/mysql-test/suite/pbxt/r/heap_btree.result
+++ b/mysql-test/suite/pbxt/r/heap_btree.result
@@ -3,8 +3,8 @@ create table t1 (a int not null,b int not null, primary key using BTREE (a)) eng
 insert into t1 values(1,1),(2,2),(3,3),(4,4);
 delete from t1 where a=1 or a=0;
 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	a	A	NULL	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	a	A	NULL	NULL	NULL		BTREE		
 select * from t1;
 a	b
 2	2
diff --git a/mysql-test/suite/pbxt/r/heap_hash.result b/mysql-test/suite/pbxt/r/heap_hash.result
index 41f00fd2ad8..c9b71f5f395 100644
--- a/mysql-test/suite/pbxt/r/heap_hash.result
+++ b/mysql-test/suite/pbxt/r/heap_hash.result
@@ -3,8 +3,8 @@ create table t1 (a int not null,b int not null, primary key using HASH (a)) engi
 insert into t1 values(1,1),(2,2),(3,3),(4,4);
 delete from t1 where a=1 or a=0;
 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	a	NULL	3	NULL	NULL		HASH	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	a	NULL	3	NULL	NULL		HASH		
 select * from t1;
 a	b
 2	2
@@ -327,15 +327,15 @@ explain select * from t1 ignore index (btree_idx) where name='matt';
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ref	heap_idx	heap_idx	22	const	7	Using where
 show index 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	id	NULL	91	NULL	NULL		HASH	
-t1	1	heap_idx	1	name	NULL	13	NULL	NULL		HASH	
-t1	1	btree_idx	1	name	A	NULL	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	id	NULL	91	NULL	NULL		HASH		
+t1	1	heap_idx	1	name	NULL	13	NULL	NULL		HASH		
+t1	1	btree_idx	1	name	A	NULL	NULL	NULL		BTREE		
 show index 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	id	NULL	91	NULL	NULL		HASH	
-t1	1	heap_idx	1	name	NULL	13	NULL	NULL		HASH	
-t1	1	btree_idx	1	name	A	NULL	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	id	NULL	91	NULL	NULL		HASH		
+t1	1	heap_idx	1	name	NULL	13	NULL	NULL		HASH		
+t1	1	btree_idx	1	name	A	NULL	NULL	NULL		BTREE		
 create table t3
 (
 a varchar(20) not null,
@@ -344,13 +344,13 @@ key (a,b)
 ) engine=heap;
 insert into t3 select name, name from t1;
 show index from t3;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t3	1	a	1	a	NULL	NULL	NULL	NULL		HASH	
-t3	1	a	2	b	NULL	13	NULL	NULL		HASH	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t3	1	a	1	a	NULL	NULL	NULL	NULL		HASH		
+t3	1	a	2	b	NULL	13	NULL	NULL		HASH		
 show index from t3;
-Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment
-t3	1	a	1	a	NULL	NULL	NULL	NULL		HASH	
-t3	1	a	2	b	NULL	13	NULL	NULL		HASH	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t3	1	a	1	a	NULL	NULL	NULL	NULL		HASH		
+t3	1	a	2	b	NULL	13	NULL	NULL		HASH		
 explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	ref	heap_idx	heap_idx	22	const	7	Using where
diff --git a/mysql-test/suite/pbxt/r/insert.result b/mysql-test/suite/pbxt/r/insert.result
index dbe38c24345..672953633b9 100644
--- a/mysql-test/suite/pbxt/r/insert.result
+++ b/mysql-test/suite/pbxt/r/insert.result
@@ -175,12 +175,12 @@ Warning	1264	Out of range value for column 'f_float_3_1_u' at row 1
 select * from t1 where number =last_insert_id();
 number	4
 original_value	1e+1111111111a
-f_double	1.79769313486232e+308
-f_float	3.40282e+38
+f_double	1.7976931348623157e308
+f_float	3.40282e38
 f_double_7_2	99999.99
 f_float_4_3	9.999
-f_double_u	1.79769313486232e+308
-f_float_u	3.40282e+38
+f_double_u	1.7976931348623157e308
+f_float_u	3.40282e38
 f_double_15_1_u	99999999999999.9
 f_float_3_1_u	99.9
 set @value= "-1e+1111111111a";
@@ -204,8 +204,8 @@ Warning	1264	Out of range value for column 'f_float_3_1_u' at row 1
 select * from t1 where number =last_insert_id();
 number	5
 original_value	-1e+1111111111a
-f_double	-1.79769313486232e+308
-f_float	-3.40282e+38
+f_double	-1.7976931348623157e308
+f_float	-3.40282e38
 f_double_7_2	-99999.99
 f_float_4_3	-9.999
 f_double_u	0
@@ -227,13 +227,13 @@ Warning	1264	Out of range value for column 'f_double_15_1_u' at row 1
 Warning	1264	Out of range value for column 'f_float_3_1_u' at row 1
 select * from t1 where number =last_insert_id();
 number	6
-original_value	1e+111
-f_double	1e+111
-f_float	3.40282e+38
+original_value	1e111
+f_double	1e111
+f_float	3.40282e38
 f_double_7_2	99999.99
 f_float_4_3	9.999
-f_double_u	1e+111
-f_float_u	3.40282e+38
+f_double_u	1e111
+f_float_u	3.40282e38
 f_double_15_1_u	99999999999999.9
 f_float_3_1_u	99.9
 set @value= -1e+111;
@@ -248,9 +248,9 @@ Warning	1264	Out of range value for column 'f_double_15_1_u' at row 1
 Warning	1264	Out of range value for column 'f_float_3_1_u' at row 1
 select * from t1 where number =last_insert_id();
 number	7
-original_value	-1e+111
-f_double	-1e+111
-f_float	-3.40282e+38
+original_value	-1e111
+f_double	-1e111
+f_float	-3.40282e38
 f_double_7_2	-99999.99
 f_float_4_3	-9.999
 f_double_u	0
diff --git a/mysql-test/suite/pbxt/r/join.result b/mysql-test/suite/pbxt/r/join.result
index 6b6dba69b32..b88b3f5f00a 100644
--- a/mysql-test/suite/pbxt/r/join.result
+++ b/mysql-test/suite/pbxt/r/join.result
@@ -699,9 +699,9 @@ select * from v1a join v1b on t1.b = t2.b;
 ERROR 42S22: Unknown column 't1.b' in 'on clause'
 select * from information_schema.statistics join information_schema.columns
 using(table_name,column_name) where table_name='user';
-TABLE_NAME	COLUMN_NAME	TABLE_CATALOG	TABLE_SCHEMA	NON_UNIQUE	INDEX_SCHEMA	INDEX_NAME	SEQ_IN_INDEX	COLLATION	CARDINALITY	SUB_PART	PACKED	NULLABLE	INDEX_TYPE	COMMENT	TABLE_CATALOG	TABLE_SCHEMA	ORDINAL_POSITION	COLUMN_DEFAULT	IS_NULLABLE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	COLUMN_TYPE	COLUMN_KEY	EXTRA	PRIVILEGES	COLUMN_COMMENT
-user	Host	NULL	mysql	0	mysql	PRIMARY	1	A	NULL	NULL	NULL		BTREE		NULL	mysql	1		NO	char	60	180	NULL	NULL	utf8	utf8_bin	char(60)	PRI		#	
-user	User	NULL	mysql	0	mysql	PRIMARY	2	A	3	NULL	NULL		BTREE		NULL	mysql	2		NO	char	16	48	NULL	NULL	utf8	utf8_bin	char(16)	PRI		#	
+TABLE_NAME	COLUMN_NAME	TABLE_CATALOG	TABLE_SCHEMA	NON_UNIQUE	INDEX_SCHEMA	INDEX_NAME	SEQ_IN_INDEX	COLLATION	CARDINALITY	SUB_PART	PACKED	NULLABLE	INDEX_TYPE	COMMENT	INDEX_COMMENT	TABLE_CATALOG	TABLE_SCHEMA	ORDINAL_POSITION	COLUMN_DEFAULT	IS_NULLABLE	DATA_TYPE	CHARACTER_MAXIMUM_LENGTH	CHARACTER_OCTET_LENGTH	NUMERIC_PRECISION	NUMERIC_SCALE	CHARACTER_SET_NAME	COLLATION_NAME	COLUMN_TYPE	COLUMN_KEY	EXTRA	PRIVILEGES	COLUMN_COMMENT
+user	Host	def	mysql	0	mysql	PRIMARY	1	A	NULL	NULL	NULL		BTREE			def	mysql	1		NO	char	60	180	NULL	NULL	utf8	utf8_bin	char(60)	PRI	#	select,insert,update,references	
+user	User	def	mysql	0	mysql	PRIMARY	2	A	4	NULL	NULL		BTREE			def	mysql	2		NO	char	16	48	NULL	NULL	utf8	utf8_bin	char(16)	PRI	#	select,insert,update,references	
 drop table t1;
 drop table t2;
 drop table t3;
diff --git a/mysql-test/suite/pbxt/r/join_outer.result b/mysql-test/suite/pbxt/r/join_outer.result
index e6ae055d811..496095680ce 100644
--- a/mysql-test/suite/pbxt/r/join_outer.result
+++ b/mysql-test/suite/pbxt/r/join_outer.result
@@ -942,25 +942,29 @@ group_concat(t1.b,t2.c)
 aaaaa
 bbbbb
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
 select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by t1.a;
 group_concat(t1.b,t2.c)
 aaaaa
 bbbbb
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
 select group_concat(t1.b,t2.c) from t1 left join t2 using(a) group by a;
 group_concat(t1.b,t2.c)
 aaaaa
 bbbbb
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
 select group_concat(t1.b,t2.c) from t1 inner join t2 using(a) group by a;
 group_concat(t1.b,t2.c)
 aaaaa
 bbbbb
 Warnings:
-Warning	1260	2 line(s) were cut by GROUP_CONCAT()
+Warning	1260	Row 1 was cut by GROUP_CONCAT()
+Warning	1260	Row 2 was cut by GROUP_CONCAT()
 drop table t1, t2;
 set group_concat_max_len=default;
 create table t1 (gid smallint(5) unsigned not null, x int(11) not null, y int(11) not null, art int(11) not null, primary key  (gid,x,y));
diff --git a/mysql-test/suite/pbxt/r/key.result b/mysql-test/suite/pbxt/r/key.result
index d727394f616..4f79581e82d 100644
--- a/mysql-test/suite/pbxt/r/key.result
+++ b/mysql-test/suite/pbxt/r/key.result
@@ -148,12 +148,12 @@ a	2
 drop table t1;
 create table t1 (a int not null unique, b int unique, c int, d int not null primary key, key(c), e int not null unique);
 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	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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+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	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));
@@ -251,13 +251,13 @@ insert t1 values ('cccc', 'tttt'),
 (0xD0B1212223D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1212223D0B1D0B1D0B1D0B1),
 (0xD0B1222123D0B1D0B1D0B1D0B1D0B1, 0xD0B1D0B1222123D0B1D0B1D0B1D0B1);
 insert t1 (c) values ('cc22');
-ERROR 23000: Duplicate entry 'cc22' for key 'c'
+ERROR 23000: Duplicate entry 'cc' for key 'c'
 insert t1 (t) values ('ttt22');
-ERROR 23000: Duplicate entry 'ttt22' for key 't'
+ERROR 23000: Duplicate entry 'ttt' for key 't'
 insert t1 (c) values (0xD0B1212322D0B1D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'б!#"Ð' for key 'c'
+ERROR 23000: Duplicate entry '\0431!' for key 'c'
 insert t1 (t) values (0xD0B1D0B1212322D0B1D0B1D0B1D0B1);
-ERROR 23000: Duplicate entry 'бб!#"б' for key 't'
+ERROR 23000: Duplicate entry '\0431\0431!' for key 't'
 select c from t1 where c='cccc';
 c
 cccc
diff --git a/mysql-test/suite/pbxt/r/key_cache.result b/mysql-test/suite/pbxt/r/key_cache.result
deleted file mode 100644
index 703389ac763..00000000000
--- a/mysql-test/suite/pbxt/r/key_cache.result
+++ /dev/null
@@ -1,322 +0,0 @@
-drop table if exists t1, t2, t3;
-SET @save_key_buffer=@@key_buffer_size;
-SELECT @@key_buffer_size, @@small.key_buffer_size;
-@@key_buffer_size	@@small.key_buffer_size
-1048576	0
-SET @@global.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-SET @@global.small.key_buffer_size=1*1024*1024;
-SET @@global.medium.key_buffer_size=4*1024*1024;
-SET @@global.medium.key_buffer_size=0;
-SET @@global.medium.key_buffer_size=0;
-SHOW VARIABLES like "key_buffer_size";
-Variable_name	Value
-key_buffer_size	16777216
-SELECT @@key_buffer_size;
-@@key_buffer_size
-16777216
-SELECT @@global.key_buffer_size;
-@@global.key_buffer_size
-16777216
-SELECT @@global.default.key_buffer_size;
-@@global.default.key_buffer_size
-16777216
-SELECT @@global.default.`key_buffer_size`;
-@@global.default.`key_buffer_size`
-16777216
-SELECT @@global.`default`.`key_buffer_size`;
-@@global.`default`.`key_buffer_size`
-16777216
-SELECT @@`default`.key_buffer_size;
-@@`default`.key_buffer_size
-16777216
-SELECT @@small.key_buffer_size;
-@@small.key_buffer_size
-1048576
-SELECT @@medium.key_buffer_size;
-@@medium.key_buffer_size
-0
-SET @@global.key_buffer_size=@save_key_buffer;
-SELECT @@default.key_buffer_size;
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default.key_buffer_size' at line 1
-SELECT @@skr.storage_engine="test";
-ERROR HY000: Variable 'storage_engine' is not a variable component (can't be used as XXXX.variable_name)
-select @@keycache1.key_cache_block_size;
-@@keycache1.key_cache_block_size
-0
-select @@keycache1.key_buffer_size;
-@@keycache1.key_buffer_size
-0
-set global keycache1.key_cache_block_size=2048;
-select @@keycache1.key_buffer_size;
-@@keycache1.key_buffer_size
-0
-select @@keycache1.key_cache_block_size;
-@@keycache1.key_cache_block_size
-2048
-set global keycache1.key_buffer_size=1*1024*1024;
-select @@keycache1.key_buffer_size;
-@@keycache1.key_buffer_size
-1048576
-select @@keycache1.key_cache_block_size;
-@@keycache1.key_cache_block_size
-2048
-set global keycache2.key_buffer_size=4*1024*1024;
-select @@keycache2.key_buffer_size;
-@@keycache2.key_buffer_size
-4194304
-select @@keycache2.key_cache_block_size;
-@@keycache2.key_cache_block_size
-1024
-set global keycache1.key_buffer_size=0;
-select @@keycache1.key_buffer_size;
-@@keycache1.key_buffer_size
-0
-select @@keycache1.key_cache_block_size;
-@@keycache1.key_cache_block_size
-2048
-select @@key_buffer_size;
-@@key_buffer_size
-1048576
-select @@key_cache_block_size;
-@@key_cache_block_size
-1024
-set global keycache1.key_buffer_size=1024*1024;
-create table t1 (p int primary key, a char(10)) delay_key_write=1;
-create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
-insert into t1 values (1, 'qqqq'), (11, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
-(3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-p	a
-1	qqqq
-11	yyyy
-select * from t2;
-p	i	a
-1	1	qqqq
-2	1	pppp
-3	1	yyyy
-4	3	zzzz
-update t1 set p=2 where p=1;
-update t2 set i=2 where i=1;
-cache index t1 key (`primary`) in keycache1;
-Table	Op	Msg_type	Msg_text
-test.t1	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-explain select p from t1;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	2	Using index
-select p from t1;
-p
-2
-11
-explain select i from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	k1	5	NULL	4	Using index
-select i from t2;
-i
-2
-2
-2
-3
-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	1	Using index
-select count(*) from t1, t2 where t1.p = t2.i;
-count(*)
-3
-cache index t2 in keycache1;
-Table	Op	Msg_type	Msg_text
-test.t2	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-update t2 set p=p+1000, i=2 where a='qqqq';
-cache index t2 in keycache2;
-Table	Op	Msg_type	Msg_text
-test.t2	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-insert into t2 values (2000, 3, 'yyyy');
-cache index t2 in keycache1;
-Table	Op	Msg_type	Msg_text
-test.t2	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-update t2 set p=3000 where a='zzzz';
-select * from t2 order by p;
-p	i	a
-2	2	pppp
-3	2	yyyy
-1001	2	qqqq
-2000	3	yyyy
-3000	3	zzzz
-explain select p from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	PRIMARY	4	NULL	5	Using index
-select p from t2;
-p
-2
-3
-1001
-2000
-3000
-explain select i from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	k1	5	NULL	5	Using index
-select i from t2;
-i
-2
-2
-2
-3
-3
-explain select a from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	k2	11	NULL	5	Using index
-select a from t2;
-a
-pppp
-qqqq
-yyyy
-yyyy
-zzzz
-cache index t1 in unknown_key_cache;
-ERROR HY000: Unknown key cache 'unknown_key_cache'
-cache index t1 key (unknown_key) in keycache1;
-Table	Op	Msg_type	Msg_text
-test.t1	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-select @@keycache2.key_buffer_size;
-@@keycache2.key_buffer_size
-4194304
-select @@keycache2.key_cache_block_size;
-@@keycache2.key_cache_block_size
-1024
-set global keycache2.key_buffer_size=0;
-select @@keycache2.key_buffer_size;
-@@keycache2.key_buffer_size
-0
-select @@keycache2.key_cache_block_size;
-@@keycache2.key_cache_block_size
-1024
-set global keycache2.key_buffer_size=1024*1024;
-select @@keycache2.key_buffer_size;
-@@keycache2.key_buffer_size
-1048576
-update t2 set p=4000 where a='zzzz';
-update t1 set p=p+1;
-set global keycache1.key_buffer_size=0;
-select * from t2 order by p;
-p	i	a
-2	2	pppp
-3	2	yyyy
-1001	2	qqqq
-2000	3	yyyy
-4000	3	zzzz
-select p from t2 order by p;
-p
-2
-3
-1001
-2000
-4000
-explain select i from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	k1	5	NULL	5	Using index
-select i from t2;
-i
-2
-2
-2
-3
-3
-explain select a from t2;
-id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	index	NULL	k2	11	NULL	5	Using index
-select a from t2;
-a
-pppp
-qqqq
-yyyy
-yyyy
-zzzz
-select * from t1;
-p	a
-12	yyyy
-3	qqqq
-select p from t1;
-p
-3
-12
-create table t3 (like t1);
-cache index t3 in small;
-Table	Op	Msg_type	Msg_text
-test.t3	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-insert into t3 select * from t1;
-cache index t3 in keycache2;
-Table	Op	Msg_type	Msg_text
-test.t3	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-cache index t1,t2 in default;
-Table	Op	Msg_type	Msg_text
-test.t1	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-test.t2	assign_to_keycache	note	The storage engine for the table doesn't support assign_to_keycache
-drop table t1,t2,t3;
-set global keycache2.key_buffer_size=0;
-set global keycache3.key_buffer_size=100;
-set global keycache3.key_buffer_size=0;
-create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;
-insert t1 values ('aaabbb');
-check table t1;
-Table	Op	Msg_type	Msg_text
-test.t1	check	status	OK
-set @my_key_cache_block_size= @@global.key_cache_block_size;
-set GLOBAL key_cache_block_size=2048;
-check table t1;
-Table	Op	Msg_type	Msg_text
-test.t1	check	status	OK
-drop table t1;
-set global key_cache_block_size= @my_key_cache_block_size;
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
-SET @my_key_cache_block_size= @@global.key_cache_block_size;
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1);
-SELECT @@key_cache_block_size;
-@@key_cache_block_size
-1536
-CHECK TABLE t1;
-Table	Op	Msg_type	Msg_text
-test.t1	check	status	OK
-DROP TABLE t1;
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1,0);
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-SELECT COUNT(*) FROM t1;
-COUNT(*)
-4181
-SELECT @@key_cache_block_size;
-@@key_cache_block_size
-1536
-CHECK TABLE t1;
-Table	Op	Msg_type	Msg_text
-test.t1	check	status	OK
-DROP TABLE t1,t2;
-set global key_cache_block_size= @my_key_cache_block_size;
-set @@global.key_buffer_size=0;
-Warnings:
-Warning	1438	Cannot drop default keycache
-select @@global.key_buffer_size;
-@@global.key_buffer_size
-1048576
diff --git a/mysql-test/suite/pbxt/r/lock.result b/mysql-test/suite/pbxt/r/lock.result
index 2ece0b36b0c..560e39591ae 100644
--- a/mysql-test/suite/pbxt/r/lock.result
+++ b/mysql-test/suite/pbxt/r/lock.result
@@ -1,4 +1,4 @@
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
 CREATE TABLE t1 (  `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY  (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
 insert into t1 (id,id2) values (1,1),(1,2),(1,3);
 LOCK TABLE t1 WRITE;
@@ -41,13 +41,16 @@ lock tables t1 write;
 check table t2;
 Table	Op	Msg_type	Msg_text
 test.t2	check	Error	Table 't2' was not locked with LOCK TABLES
-test.t2	check	error	Corrupt
+test.t2	check	status	Operation failed
 insert into t1 select index1,nr from t1;
 ERROR HY000: Table 't1' was not locked with LOCK TABLES
 unlock tables;
 lock tables t1 write, t1 as t1_alias read;
 insert into t1 select index1,nr from t1 as t1_alias;
 drop table t1,t2;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+unlock tables;
+drop table t1,t2;
 create table t1 (c1 int);
 create table t2 (c1 int);
 create table t3 (c1 int);
@@ -69,6 +72,10 @@ ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
 delete t2 from t1,t2 where t1.a=t2.a;
 ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
 drop table t1,t2;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+unlock tables;
+drop table t2,t1;
+End of 4.1 tests.
 drop table if exists t1;
 create table t1 (a int);
 lock table t1 write;
diff --git a/mysql-test/suite/pbxt/r/lock_multi.result b/mysql-test/suite/pbxt/r/lock_multi.result
index 731ccedeecb..29010d93bfe 100644
--- a/mysql-test/suite/pbxt/r/lock_multi.result
+++ b/mysql-test/suite/pbxt/r/lock_multi.result
@@ -9,6 +9,7 @@ update t1,t2 set c=a where b=d;
 select c from t2;
 c
 2
+unlock tables;
 drop table t1;
 drop table t2;
 create table t1 (a int);
@@ -16,6 +17,7 @@ create table t2 (a int);
 lock table t1 write, t2 write;
 insert t1 select * from t2;
 drop table t2;
+unlock tables;
 ERROR 42S02: Table 'test.t2' doesn't exist
 drop table t1;
 create table t1 (a int);
@@ -23,6 +25,7 @@ create table t2 (a int);
 lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
 insert t1 select * from t2;
 drop table t2;
+unlock tables;
 ERROR 42S02: Table 'test.t2' doesn't exist
 drop table t1;
 End of 4.1 tests
@@ -53,9 +56,10 @@ CREATE TABLE t1 (c1 int);
 LOCK TABLE t1 WRITE;
 FLUSH TABLES WITH READ LOCK;
 CREATE TABLE t2 (c1 int);
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
 UNLOCK TABLES;
 UNLOCK TABLES;
-DROP TABLE t1, t2;
+DROP TABLE t1;
 CREATE TABLE t1 (c1 int);
 LOCK TABLE t1 WRITE;
 FLUSH TABLES WITH READ LOCK;
@@ -134,17 +138,6 @@ unlock tables;
 unlock tables;
 drop table t1,t2;
 End of 5.0 tests
-create table t1 (i int);
-lock table t1 read;
-update t1 set i= 10;
-select * from t1;
-Timeout in wait_condition.inc for select count(*) = 1 from information_schema.processlist
-where state = "Locked" and info = "select * from t1"
-kill query ID;
-i
-ERROR 70100: Query execution was interrupted
-unlock tables;
-drop table t1;
 drop table if exists t1;
 create table t1 (i int);
 connection: default
@@ -179,10 +172,11 @@ drop table if exists t1,t2;
 create table t1 (a int);
 flush status;
 lock tables t1 read;
-insert into t1 values(1);;
+insert into t1 values(1);
 unlock tables;
 drop table t1;
 select @tlwa < @tlwb;
 @tlwa < @tlwb
 1
 End of 5.1 tests
+drop database pbxt;
diff --git a/mysql-test/suite/pbxt/r/metadata.result b/mysql-test/suite/pbxt/r/metadata.result
index c46c6e26ce4..af2b2bd4158 100644
--- a/mysql-test/suite/pbxt/r/metadata.result
+++ b/mysql-test/suite/pbxt/r/metadata.result
@@ -2,7 +2,7 @@ drop table if exists t1,t2;
 select 1, 1.0, -1, "hello", NULL;
 Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
 def					1	8	1	1	N	32897	0	63
-def					1.0	246	4	3	N	129	1	63
+def					1.0	246	4	3	N	32897	1	63
 def					-1	8	2	2	N	32897	0	63
 def					hello	253	5	5	N	1	31	8
 def					NULL	6	0	0	Y	32896	0	63
@@ -18,7 +18,7 @@ def	test	t1	t1	d	d	3	11	0	Y	32768	0	63
 def	test	t1	t1	e	e	8	20	0	Y	32768	0	63
 def	test	t1	t1	f	f	4	3	0	Y	32768	2	63
 def	test	t1	t1	g	g	5	4	0	Y	32768	3	63
-def	test	t1	t1	h	h	246	7	0	Y	0	4	63
+def	test	t1	t1	h	h	246	7	0	Y	32768	4	63
 def	test	t1	t1	i	i	13	4	0	Y	32864	0	63
 def	test	t1	t1	j	j	10	10	0	Y	128	0	63
 def	test	t1	t1	k	k	7	19	0	N	9441	0	63
diff --git a/mysql-test/suite/pbxt/r/mysqlshow.result b/mysql-test/suite/pbxt/r/mysqlshow.result
index 674ec1a7cda..4898da69b98 100644
--- a/mysql-test/suite/pbxt/r/mysqlshow.result
+++ b/mysql-test/suite/pbxt/r/mysqlshow.result
@@ -93,6 +93,7 @@ Database: information_schema
 | INDEX_STATISTICS                      |
 | KEY_CACHES                            |
 | KEY_COLUMN_USAGE                      |
+| PARAMETERS                            |
 | PARTITIONS                            |
 | PLUGINS                               |
 | PROCESSLIST                           |
@@ -105,6 +106,7 @@ Database: information_schema
 | SESSION_VARIABLES                     |
 | STATISTICS                            |
 | TABLES                                |
+| TABLESPACES                           |
 | TABLE_CONSTRAINTS                     |
 | TABLE_PRIVILEGES                      |
 | TABLE_STATISTICS                      |
@@ -112,25 +114,7 @@ Database: information_schema
 | USER_PRIVILEGES                       |
 | USER_STATISTICS                       |
 | VIEWS                                 |
-| INNODB_BUFFER_POOL_PAGES              |
 | PBXT_STATISTICS                       |
-| INNODB_CMP                            |
-| INNODB_RSEG                           |
-| XTRADB_ENHANCEMENTS                   |
-| INNODB_BUFFER_POOL_PAGES_INDEX        |
-| XTRADB_ADMIN_COMMAND                  |
-| INNODB_TRX                            |
-| INNODB_SYS_TABLES                     |
-| INNODB_LOCK_WAITS                     |
-| INNODB_SYS_STATS                      |
-| INNODB_LOCKS                          |
-| INNODB_CMPMEM                         |
-| INNODB_TABLE_STATS                    |
-| INNODB_SYS_INDEXES                    |
-| INNODB_CMP_RESET                      |
-| INNODB_BUFFER_POOL_PAGES_BLOB         |
-| INNODB_CMPMEM_RESET                   |
-| INNODB_INDEX_STATS                    |
 +---------------------------------------+
 Database: INFORMATION_SCHEMA
 +---------------------------------------+
@@ -150,6 +134,7 @@ Database: INFORMATION_SCHEMA
 | INDEX_STATISTICS                      |
 | KEY_CACHES                            |
 | KEY_COLUMN_USAGE                      |
+| PARAMETERS                            |
 | PARTITIONS                            |
 | PLUGINS                               |
 | PROCESSLIST                           |
@@ -162,6 +147,7 @@ Database: INFORMATION_SCHEMA
 | SESSION_VARIABLES                     |
 | STATISTICS                            |
 | TABLES                                |
+| TABLESPACES                           |
 | TABLE_CONSTRAINTS                     |
 | TABLE_PRIVILEGES                      |
 | TABLE_STATISTICS                      |
@@ -169,25 +155,7 @@ Database: INFORMATION_SCHEMA
 | USER_PRIVILEGES                       |
 | USER_STATISTICS                       |
 | VIEWS                                 |
-| INNODB_BUFFER_POOL_PAGES              |
 | PBXT_STATISTICS                       |
-| INNODB_CMP                            |
-| INNODB_RSEG                           |
-| XTRADB_ENHANCEMENTS                   |
-| INNODB_BUFFER_POOL_PAGES_INDEX        |
-| XTRADB_ADMIN_COMMAND                  |
-| INNODB_TRX                            |
-| INNODB_SYS_TABLES                     |
-| INNODB_LOCK_WAITS                     |
-| INNODB_SYS_STATS                      |
-| INNODB_LOCKS                          |
-| INNODB_CMPMEM                         |
-| INNODB_TABLE_STATS                    |
-| INNODB_SYS_INDEXES                    |
-| INNODB_CMP_RESET                      |
-| INNODB_BUFFER_POOL_PAGES_BLOB         |
-| INNODB_CMPMEM_RESET                   |
-| INNODB_INDEX_STATS                    |
 +---------------------------------------+
 Wildcard: inf_rmation_schema
 +--------------------+
diff --git a/mysql-test/suite/pbxt/r/null.result b/mysql-test/suite/pbxt/r/null.result
index f931679c96c..b05a58b9494 100644
--- a/mysql-test/suite/pbxt/r/null.result
+++ b/mysql-test/suite/pbxt/r/null.result
@@ -94,7 +94,7 @@ Warnings:
 Warning	1265	Data truncated for column 'd' at row 1
 UPDATE t1 SET d=1/NULL;
 Warnings:
-Warning	1265	Data truncated for column 'd' at row 1
+Warning	1048	Column 'd' cannot be null
 UPDATE t1 SET d=NULL;
 Warnings:
 Warning	1048	Column 'd' cannot be null
diff --git a/mysql-test/suite/pbxt/r/null_key.result b/mysql-test/suite/pbxt/r/null_key.result
index 272120e46a4..cfa83397daa 100644
--- a/mysql-test/suite/pbxt/r/null_key.result
+++ b/mysql-test/suite/pbxt/r/null_key.result
@@ -424,6 +424,7 @@ SHOW STATUS LIKE "handler_read%";
 Variable_name	Value
 Handler_read_first	0
 Handler_read_key	6
+Handler_read_last	0
 Handler_read_next	2
 Handler_read_prev	0
 Handler_read_rnd	0
diff --git a/mysql-test/suite/pbxt/r/odbc.result b/mysql-test/suite/pbxt/r/odbc.result
index 5629d3dab33..b15c55b1b5b 100644
--- a/mysql-test/suite/pbxt/r/odbc.result
+++ b/mysql-test/suite/pbxt/r/odbc.result
@@ -1,4 +1,5 @@
 drop table if exists t1;
+set @@session.sql_auto_is_null=1;
 select {fn length("hello")}, { date "1997-10-20" };
 {fn length("hello")}	1997-10-20
 5	1997-10-20
@@ -7,9 +8,9 @@ insert into t1 SET A=NULL,B=1;
 insert into t1 SET a=null,b=2;
 select * from t1 where a is null and b=2;
 a	b
-2	2
 select * from t1 where a is null;
 a	b
+2	2
 explain select * from t1 where b is null;
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
diff --git a/mysql-test/suite/pbxt/r/partition_error.result b/mysql-test/suite/pbxt/r/partition_error.result
index a36d0bddabb..42a0587eb8c 100644
--- a/mysql-test/suite/pbxt/r/partition_error.result
+++ b/mysql-test/suite/pbxt/r/partition_error.result
@@ -1,4 +1,4 @@
-drop table if exists t1;
+drop table if exists t1, t2;
 partition by list (a)
 partitions 3
 (partition x1 values in (1,2,9,4) tablespace ts1,
@@ -65,8 +65,8 @@ partitions 3
 partition x2 tablespace ts2,
 partition x3 tablespace ts3);
 ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -142,8 +142,8 @@ partitions 2
 (partition x1 values less than (4),
 partition x2 values less than (5));
 ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -155,8 +155,8 @@ partitions 2
 (partition x1 values in (4),
 partition x2 values in (5));
 ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -168,8 +168,8 @@ partitions 2
 (partition x1 values in (4,6),
 partition x2 values in (5,7));
 ERROR HY000: Only LIST PARTITIONING can use VALUES IN in partition definition
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -179,8 +179,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by key (b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -190,8 +190,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by key (a, b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -201,8 +201,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by hash (a+b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -212,8 +212,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by key (b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -223,8 +223,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by key (a, b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -234,8 +234,8 @@ primary key (a,b))
 partition by key (a)
 subpartition by hash (a+b);
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -255,8 +255,8 @@ subpartition by hash (sin(a+b))
 (partition x1 (subpartition x11, subpartition x12),
 partition x2 (subpartition x21, subpartition x22));
 ERROR HY000: It is only possible to mix RANGE/LIST partitioning with HASH/KEY partitioning for subpartitioning
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -280,8 +280,8 @@ subpartition by key (a,d)
 (partition x1 values less than (1) (subpartition x11, subpartition x12),
 partition x2 values less than (2) (subpartition x21, subpartition x22));
 ERROR HY000: Field in list of fields for partition function not found in table
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -308,8 +308,8 @@ c int not null,
 primary key(a,b))
 partition by range (a);
 ERROR HY000: For RANGE partitions each partition must be defined
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
-load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par')
+select load_file('$MYSQLD_DATADIR/test/t1.par');
+load_file('$MYSQLD_DATADIR/test/t1.par')
 NULL
 CREATE TABLE t1 (
 a int not null,
@@ -330,8 +330,7 @@ partition by range (a)
 partitions 2
 (partition x1 values less than (4.0) tablespace ts1,
 partition x2 values less than (8) tablespace ts2);
-ERROR 42000: VALUES value must be of same type as partition function near ') tablespace ts1,
-partition x2 values less than (8) tablespace ts2)' at line 8
+ERROR HY000: VALUES value for partition 'x1' must have type INT
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -381,8 +380,7 @@ partition by list (a)
 partitions 2
 (partition x1 values less than 4,
 partition x2 values less than (5));
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4,
-partition x2 values less than (5))' at line 8
+ERROR HY000: Only RANGE PARTITIONING can use VALUES LESS THAN in partition definition
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -392,7 +390,7 @@ partition by range (a)
 partitions 2
 (partition x1 values less than maxvalue,
 partition x2 values less than (5));
-ERROR 42000: MAXVALUE can only be used in last partition definition near '))' at line 9
+ERROR HY000: MAXVALUE can only be used in last partition definition
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -402,7 +400,7 @@ partition by range (a)
 partitions 2
 (partition x1 values less than maxvalue,
 partition x2 values less than maxvalue);
-ERROR 42000: MAXVALUE can only be used in last partition definition near 'maxvalue)' at line 9
+ERROR HY000: MAXVALUE can only be used in last partition definition
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -571,8 +569,7 @@ partition by list (a)
 partitions 2
 (partition x1 values in (4.0, 12+8),
 partition x2 values in (3, 21));
-ERROR 42000: VALUES value must be of same type as partition function near ' 12+8),
-partition x2 values in (3, 21))' at line 8
+ERROR HY000: VALUES value for partition 'x1' must have type INT
 CREATE TABLE t1 (
 a int not null,
 b int not null,
diff --git a/mysql-test/suite/pbxt/r/partition_hash.result b/mysql-test/suite/pbxt/r/partition_hash.result
index c32c27bf9c6..c5880644363 100644
--- a/mysql-test/suite/pbxt/r/partition_hash.result
+++ b/mysql-test/suite/pbxt/r/partition_hash.result
@@ -57,31 +57,31 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
 explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p0,p2,p3	ALL	NULL	NULL	NULL	NULL	7	Using where
 explain partitions select * from t1 where a is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t1 where a is not null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
 explain partitions select * from t1 where a >= 1 and a < 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	5	Using where
 explain partitions select * from t1 where a >= 3 and a <= 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t1 where a > 2 and a < 4;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a > 3 and a <= 6;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t1 where a > 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
 explain partitions select * from t1 where a >= 1 and a <= 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0,p1,p2,p3	ALL	NULL	NULL	NULL	NULL	9	Using where
+1	SIMPLE	t1	p0,p1,p2	ALL	NULL	NULL	NULL	NULL	7	Using where
 drop table t1;
 CREATE TABLE t1 (
 a int not null,
diff --git a/mysql-test/suite/pbxt/r/partition_pruning.result b/mysql-test/suite/pbxt/r/partition_pruning.result
index 218ada09d3b..e5e75c55ffb 100644
--- a/mysql-test/suite/pbxt/r/partition_pruning.result
+++ b/mysql-test/suite/pbxt/r/partition_pruning.result
@@ -14,7 +14,7 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a=2;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a=1 or a=2;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
@@ -31,7 +31,7 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t2 where a=1 and b=1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 create table t3 (
 a int
 )
@@ -42,16 +42,16 @@ partition p1 values less than (20)
 insert into t3 values (5),(15);
 explain partitions select * from t3 where a=11;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	p1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t3	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t3 where a=10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3	p1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t3	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t3 where a=20;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3		ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t3		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t3 where a=30;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t3		ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t3		ALL	NULL	NULL	NULL	NULL	0	Using where
 create table t4 (a int not null, b int not null) partition by LIST (a+b) (
 partition p0 values in (12),
 partition p1 values in (14)
@@ -59,11 +59,11 @@ partition p1 values in (14)
 insert into t4 values (10,2), (10,4);
 explain partitions select * from t4 where (a=10 and b=1) or (a=10 and b=2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t4	p0	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t4	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t4 
 where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t4	p0	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t4	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t4 where (a=10 and b=2) or (a=10 and b=3)
 or (a=10 and b = 4);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
@@ -89,25 +89,25 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 explain partitions select * from t5
 where (a=10 and b=1) or (a=10 and b=2) or (a=10 and b = 3);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t5	p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t5	p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t5 where (a=10 and b=2) or (a=10 and b=3)
 or (a=10 and b = 4);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t5 where (c=1 and d=1);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t5	p0_p0sp0,p1_p1sp0	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t5	p0_p0sp0,p1_p1sp0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t5 where (c=2 and d=1);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t5	p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t5	p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or 
 (c=2 and d=1);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t5 where (a=10 and b=2 and c=1 and d=1) or 
 (b=2 and c=2 and d=1);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t5	p0_p0sp0,p0_p0sp1,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	3	Using where
 create table t6 (a int not null) partition by LIST(a) (
 partition p1 values in (1),
 partition p3 values in (3),
@@ -121,34 +121,34 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a <= 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >  9;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a >= 9;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p9	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6	p9	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a > 0 and a < 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6	p1,p3	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a > 5 and a < 12;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p7,p9	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	SIMPLE	t6	p7,p9	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a > 3 and a < 8 ;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >= 0 and a <= 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6	p1,p3,p5	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t6 where a >= 5 and a <= 12;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p5,p7,p9	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p5,p7,p9	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >= 3 and a <= 8;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a > 3 and a < 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 drop table t6;
 create table t6 (a int unsigned not null) partition by LIST(a) (
 partition p1 values in (1),
@@ -163,34 +163,34 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a <= 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6	p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >  9;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a >= 9;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p9	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t6	p9	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a > 0 and a < 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6	p1,p3	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a > 5 and a < 12;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p7,p9	ALL	NULL	NULL	NULL	NULL	2	Using where
+1	SIMPLE	t6	p7,p9	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t6 where a > 3 and a < 8 ;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >= 0 and a <= 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t6	p1,p3,p5	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t6 where a >= 5 and a <= 12;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p5,p7,p9	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p5,p7,p9	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a >= 3 and a <= 8;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6	p3,p5,p7	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t6 where a > 3 and a < 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t6		ALL	NULL	NULL	NULL	NULL	0	Using where
 create table t7 (a int not null) partition by RANGE(a) (
 partition p10 values less than (10),
 partition p30 values less than (30),
@@ -207,25 +207,25 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t7	p10	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a <= 10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p10,p30	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t7	p10,p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t7 where a = 10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t7 where a < 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t7	p10,p30,p50,p70,p90	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t7 where a = 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a > 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a >= 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a > 11 and a < 29;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 drop table t7;
 create table t7 (a int unsigned not null) partition by RANGE(a) (
 partition p10 values less than (10),
@@ -243,25 +243,25 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t7	p10	ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a <= 10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p10,p30	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t7	p10,p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t7 where a = 10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t7 where a < 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t7	p10,p30,p50,p70,p90	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t7 where a = 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a > 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a >= 90;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t7 where a > 11 and a < 29;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t7	p30	ALL	NULL	NULL	NULL	NULL	2	Using where
 create table t8 (a date not null) partition by RANGE(YEAR(a)) (
 partition p0 values less than (1980),
 partition p1 values less than (1990),
@@ -270,7 +270,7 @@ partition p2 values less than (2000)
 insert into t8 values ('1985-05-05'),('1995-05-05');
 explain partitions select * from t8 where a < '1980-02-02';
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t8	p0,p1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t8	p0,p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 create table t9 (a date not null) partition by RANGE(TO_DAYS(a)) (
 partition p0 values less than (732299), -- 2004-12-19
 partition p1 values less than (732468), -- 2005-06-06
@@ -295,13 +295,13 @@ partition p2 values less than (9)
 insert into t1 values (1),(2),(3);
 explain partitions select * from t1 where a1 > 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a1 >= 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a1 < 3 and a1 > 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 drop table t1;
 create table t3 (a int, b int) 
 partition by list(a) subpartition by hash(b) subpartitions 4 (
@@ -325,7 +325,7 @@ create table t1 (a int) partition by hash(a) partitions 2;
 insert into t1 values (1),(2);
 explain partitions select * from t1 where a is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a is not null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	2	Using where
@@ -342,20 +342,20 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 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	X	p1,p2	ALL	a	NULL	NULL	NULL	2	Using where
 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);
 explain partitions select * from t1 where a >  1 and a < 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a >= 1 and a < 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p1,p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a >  1 and a <= 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	p2,p3	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a >= 1 and a <= 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p1,p2,p3	ALL	NULL	NULL	NULL	NULL	3	Using where
@@ -371,10 +371,10 @@ partition p3 values in (3)
 insert into t1 values (1,1),(2,2),(3,3);
 explain partitions select * from t1 where b >  1 and b < 3;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p0_p0sp2,p1_p1sp2,p2_p2sp2,p3_p3sp2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where b >  1 and b < 3 and (a =1 or a =2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p1_p1sp2,p2_p2sp2	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p1_p1sp2,p2_p2sp2	ALL	NULL	NULL	NULL	NULL	2	Using where
 drop table t1;
 create table t1 (a int) partition by list(a) (
 partition p0 values in (1,2),
@@ -445,22 +445,22 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	
 explain partitions select * from t2 where a < 801 and a > 200;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	800	Using where
 explain partitions select * from t2 where a < 801 and a > 800;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	200	Using where
 explain partitions select * from t2 where a > 600;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
 explain partitions select * from t2 where a > 600 and b = 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
 explain partitions select * from t2 where a > 600 and b = 4;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
 explain partitions select * from t2 where a > 600 and b = 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
+1	SIMPLE	t2	p3,p4	ALL	NULL	NULL	NULL	NULL	400	Using where
 explain partitions select * from t2 where b = 5;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	1010	Using where
@@ -515,19 +515,19 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	p0,p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	910	
 explain partitions select * from t2 where a = 101;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	110	Using where
 explain partitions select * from t2 where a = 550;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	200	Using where
 explain partitions select * from t2 where a = 833;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p4	ALL	NULL	NULL	NULL	NULL	200	Using where
 explain partitions select * from t2 where (a = 100 OR a = 900);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0,p4	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p0,p4	ALL	NULL	NULL	NULL	NULL	310	Using where
 explain partitions select * from t2 where (a > 100 AND a < 600);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0,p1,p2	ALL	NULL	NULL	NULL	NULL	910	Using where
+1	SIMPLE	t2	p0,p1,p2	ALL	NULL	NULL	NULL	NULL	510	Using where
 analyze table t2;
 Table	Op	Msg_type	Msg_text
 test.t2	analyze	status	OK
@@ -692,7 +692,7 @@ f_int1
 NULL
 explain partitions select * from t1 where f_int1 is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	part4_part4sp0	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	part4_part4sp0	ALL	NULL	NULL	NULL	NULL	2	Using where
 drop table t1;
 create table t1 (a int not null, b int not null)
 partition by list(a) 
@@ -721,10 +721,10 @@ insert into t1 values (1,1),(1,2),(1,3),(1,4),
 (2,1),(2,2),(2,3),(2,4), (NULL,1);
 explain partitions select * from t1 where a IS NULL AND (b=1 OR b=2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pn_pnsp0,pn_pnsp1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	pn_pnsp0,pn_pnsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where (a IS NULL or a < 1) AND (b=1 OR b=2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pn_pnsp0,pn_pnsp1	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	pn_pnsp0,pn_pnsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where (a IS NULL or a < 2) AND (b=1 OR b=2);
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p0_p0sp0,p0_p0sp1,pn_pnsp0,pn_pnsp1	ALL	NULL	NULL	NULL	NULL	5	Using where
@@ -753,7 +753,7 @@ count(*)
 1
 explain partitions select count(*) from t1 where s1 < 0 or s1 is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p3	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p3	ALL	NULL	NULL	NULL	NULL	2	Using where
 drop table t1;
 create table t1 (a char(32) primary key)
 partition by key()
@@ -812,24 +812,24 @@ insert into t1 values (18446744073709551000+1);
 insert into t1 values (18446744073709551614-1);
 explain partitions select * from t1 where a < 10;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	1	Using where
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 
 where a >= 18446744073709551000-1 and a <= 18446744073709551000+1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p3,p4	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p3,p4	ALL	NULL	NULL	NULL	NULL	3	Using where
 explain partitions select * from t1 
 where a between 18446744073709551001 and 18446744073709551002;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a = 18446744073709551000;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a = 18446744073709551613;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p4	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a = 18446744073709551614;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 drop table t1;
 create table t1 (a int)
 partition by range(a) (
@@ -853,34 +853,34 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a=0xFE;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t2 where a=0xFE;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a > 0xFE AND a <= 0xFF;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t2 where a > 0xFE AND a <= 0xFF;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2		ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t2		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t1 where a >= 0xFE AND a <= 0xFF;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t2 where a >= 0xFE AND a <= 0xFF;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t2	p2	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a < 64 AND a >= 63;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t2 where a < 64 AND a >= 63;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t2	p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a <= 64 AND a >= 63;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t2 where a <= 64 AND a >= 63;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t2	p0,p1	ALL	NULL	NULL	NULL	NULL	4	Using where
 drop table t1;
 drop table t2;
 create table t1(a bigint unsigned not null) partition by range(a+0) (
@@ -898,7 +898,7 @@ id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 explain partitions select * from t1 where 
 a > 0xFFFFFFFFFFFFFFEC and a < 0xFFFFFFFFFFFFFFEE;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	4	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 explain partitions select * from t1 where a>=0 and a <= 0xFFFFFFFFFFFFFFFF;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t1	p1,p2,p3,p4	ALL	NULL	NULL	NULL	NULL	8	Using where
diff --git a/mysql-test/suite/pbxt/r/partition_range.result b/mysql-test/suite/pbxt/r/partition_range.result
index 4f41c667a5d..a8c4e36cbc2 100644
--- a/mysql-test/suite/pbxt/r/partition_range.result
+++ b/mysql-test/suite/pbxt/r/partition_range.result
@@ -21,19 +21,19 @@ select * from t1 where a > 1;
 a
 explain partitions select * from t1 where a is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	pnull	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a >= 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	p0,p1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a < 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	pnull	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a <= 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull,p0	ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1	pnull,p0	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a > 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	3	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 drop table t1;
 create table t1 (a int unsigned, b int unsigned)
 partition by range (a)
@@ -63,19 +63,19 @@ select * from t1 where a > 1;
 a	b
 explain partitions select * from t1 where a is null;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a >= 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1	p0_p0sp0,p0_p0sp1,p1_p1sp0,p1_p1sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t1 where a < 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1	ALL	NULL	NULL	NULL	NULL	2	Using where
 explain partitions select * from t1 where a <= 0;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1	pnull_pnullsp0,pnull_pnullsp1,p0_p0sp0,p0_p0sp1	ALL	NULL	NULL	NULL	NULL	4	Using where
 explain partitions select * from t1 where a > 1;
 id	select_type	table	partitions	type	possible_keys	key	key_len	ref	rows	Extra
-1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	6	Using where
+1	SIMPLE	t1		ALL	NULL	NULL	NULL	NULL	0	Using where
 drop table t1;
 CREATE TABLE t1 (
 a int not null,
diff --git a/mysql-test/suite/pbxt/r/pbxt_bugs.result b/mysql-test/suite/pbxt/r/pbxt_bugs.result
index a9f62ff69bc..68516cce064 100644
--- a/mysql-test/suite/pbxt/r/pbxt_bugs.result
+++ b/mysql-test/suite/pbxt/r/pbxt_bugs.result
@@ -665,30 +665,30 @@ create table t2 (s1 int, foreign key (s1) references t1 (s1)) engine = pbxt;
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	PRIMARY	NONE	RESTRICT	RESTRICT	t2	t1
+def	test	FOREIGN_1	def	test	PRIMARY	NONE	RESTRICT	RESTRICT	t2	t1
 drop table t2, t1;
 create table t1 (s1 int, s2 int, unique key ix1 (s1, s2)) engine = pbxt;
 create table t2 (s1 int, s2 int, foreign key (s1, s2) references t1 (s1, s2)) engine = pbxt;
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
+def	test	FOREIGN_1	def	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
 drop table t2, t1;
 create table t1 (s1 int, s2 int, unique key ix1 (s1, s2), unique key ix2 (s1, s2)) engine = pbxt;
 create table t2 (s1 int, s2 int, foreign key (s1, s2) references t1 (s1, s2)) engine = pbxt;
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
+def	test	FOREIGN_1	def	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
 drop table t2, t1;
 create table t1 (s1 int, s2 int, unique key ix1 (s1, s2)) engine = pbxt;
 create table t2 (s1 int, s2 int, 
@@ -696,20 +696,20 @@ foreign key (s1, s2) references t1 (s1, s2) on delete cascade on update set null
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	ix1	NONE	SET NULL	CASCADE	t2	t1
+def	test	FOREIGN_1	def	test	ix1	NONE	SET NULL	CASCADE	t2	t1
 drop table t2, t1;
 create table t2 (s1 int, s2 int, s3 int, s4 int, unique key ix34 (s3, s4),
 foreign key (s1, s2) references t2 (s3, s4)) engine = pbxt;
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't2';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	ix34	NONE	RESTRICT	RESTRICT	t2	t2
+def	test	FOREIGN_1	def	test	ix34	NONE	RESTRICT	RESTRICT	t2	t2
 drop table t2;
 create table t1 (s1 int, s2 int, unique key ix1 (s1, s2)) engine = pbxt;
 create table t2 (s1 int, s2 int, 
@@ -718,12 +718,12 @@ alter table t1 add constraint s2 foreign key (s1, s2) references t2 (s1, s2);
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  (table_name = 't1' or table_name = 't2');
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	s2	test	t1	FOREIGN KEY
-NULL	test	FOREIGN_1	test	t2	FOREIGN KEY
+def	test	s2	test	t1	FOREIGN KEY
+def	test	FOREIGN_1	test	t2	FOREIGN KEY
 select * from information_schema.referential_constraints where (table_name = 't1' or table_name = 't2');
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	s2	NULL	test	s1	NONE	RESTRICT	RESTRICT	t1	t2
-NULL	test	FOREIGN_1	NULL	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
+def	test	s2	def	test	s1	NONE	RESTRICT	RESTRICT	t1	t2
+def	test	FOREIGN_1	def	test	ix1	NONE	RESTRICT	RESTRICT	t2	t1
 set foreign_key_checks = 0;
 drop table t2, t1;
 set foreign_key_checks = 1;
@@ -731,10 +731,10 @@ create table t1 (id int primary key, s1 int, foreign key (s1) references t1 (id)
 select * from information_schema.table_constraints
 where constraint_type = 'FOREIGN KEY' and  table_name = 't1';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	TABLE_SCHEMA	TABLE_NAME	CONSTRAINT_TYPE
-NULL	test	FOREIGN_1	test	t1	FOREIGN KEY
+def	test	FOREIGN_1	test	t1	FOREIGN KEY
 select * from information_schema.referential_constraints where table_name = 't1';
 CONSTRAINT_CATALOG	CONSTRAINT_SCHEMA	CONSTRAINT_NAME	UNIQUE_CONSTRAINT_CATALOG	UNIQUE_CONSTRAINT_SCHEMA	UNIQUE_CONSTRAINT_NAME	MATCH_OPTION	UPDATE_RULE	DELETE_RULE	TABLE_NAME	REFERENCED_TABLE_NAME
-NULL	test	FOREIGN_1	NULL	test	PRIMARY	NONE	RESTRICT	RESTRICT	t1	t1
+def	test	FOREIGN_1	def	test	PRIMARY	NONE	RESTRICT	RESTRICT	t1	t1
 drop table t1;
 drop table if exists t2,t1;
 create table t1 (s1 int primary key) engine = pbxt;
diff --git a/mysql-test/suite/pbxt/r/pbxt_my_fail2.result b/mysql-test/suite/pbxt/r/pbxt_my_fail2.result
index 75b3073c2cb..c1810b66a2a 100644
--- a/mysql-test/suite/pbxt/r/pbxt_my_fail2.result
+++ b/mysql-test/suite/pbxt/r/pbxt_my_fail2.result
@@ -40,6 +40,8 @@ end|
 call bug7049_2()|
 Result
 Caught it
+Warnings:
+Error	1062	Duplicate entry '42' for key 'x'
 drop procedure bug7049_1|
 drop function bug7049_1|
 drop procedure bug7049_2|
diff --git a/mysql-test/suite/pbxt/r/pbxt_transactions.result b/mysql-test/suite/pbxt/r/pbxt_transactions.result
index be38920c205..dff9ad03baa 100644
--- a/mysql-test/suite/pbxt/r/pbxt_transactions.result
+++ b/mysql-test/suite/pbxt/r/pbxt_transactions.result
@@ -529,10 +529,14 @@ end|
 call t3_update()|
 t3_update
 Inner (good)
+Warnings:
+Error	1062	Duplicate entry '1' for key 'PRIMARY'
 begin|
 call t3_update()|
 t3_update
 Inner (good)
+Warnings:
+Error	1062	Duplicate entry '1' for key 'PRIMARY'
 commit|
 drop table if exists t3|
 drop procedure if exists t3_update|
diff --git a/mysql-test/suite/pbxt/r/ps_1general.result b/mysql-test/suite/pbxt/r/ps_1general.result
index c4404cb5cd9..4fb307d2646 100644
--- a/mysql-test/suite/pbxt/r/ps_1general.result
+++ b/mysql-test/suite/pbxt/r/ps_1general.result
@@ -263,6 +263,7 @@ information_schema
 mtr
 mysql
 pbxt
+performance_schema
 test
 prepare stmt4 from ' show tables from test like ''t2%'' ';
 execute stmt4;
@@ -280,6 +281,9 @@ b	char(10)	YES		NULL
 SET @arg00=1;
 execute stmt4 using @arg00;
 Field	Type	Null	Key	Default	Extra
+Warnings:
+Warning	1292	Truncated incorrect DOUBLE value: 'a'
+Warning	1292	Truncated incorrect DOUBLE value: 'b'
 prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
 execute stmt4;
 Field	Type	Null	Key	Default	Extra
@@ -287,9 +291,9 @@ a	int(11)	NO	PRI	NULL
 create index t2_idx on t2(b);
 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	0	NULL	NULL	YES	BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t2	0	PRIMARY	1	a	A	0	NULL	NULL		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
@@ -306,8 +310,9 @@ prepare stmt4 from ' show variables like ''sql_mode'' ';
 execute stmt4;
 Variable_name	Value
 sql_mode	
-prepare stmt4 from ' show engine pbxt logs ';
+prepare stmt4 from ' show engine myisam logs ';
 execute stmt4;
+Type	Name	Status
 prepare stmt4 from ' show grants for user ';
 prepare stmt4 from ' show create table t2 ';
 prepare stmt4 from ' show master status ';
@@ -400,17 +405,15 @@ prepare stmt3 from ' lock tables t1 read ' ;
 ERROR HY000: This command is not supported in the prepared statement protocol yet
 prepare stmt3 from ' unlock tables ' ;
 ERROR HY000: This command is not supported in the prepared statement protocol yet
-prepare stmt1 from ' load data infile ''data.txt''
-into table t1 fields terminated by ''\t'' ';
+prepare stmt1 from ' load data infile ''<MYSQLTEST_VARDIR>/tmp/data.txt''
+     into table t1 fields terminated by ''\t'' ';
 ERROR HY000: This command is not supported in the prepared statement protocol yet
-prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
+prepare stmt1 from ' select * into outfile ''<MYSQLTEST_VARDIR>/tmp/data.txt'' from t1 ';
 execute stmt1 ;
 prepare stmt1 from ' optimize table t1 ' ;
 prepare stmt1 from ' analyze table t1 ' ;
 prepare stmt1 from ' checksum table t1 ' ;
 prepare stmt1 from ' repair table t1 ' ;
-prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
-ERROR HY000: This command is not supported in the prepared statement protocol yet
 prepare stmt1 from ' handler t1 open ';
 ERROR HY000: This command is not supported in the prepared statement protocol yet
 prepare stmt3 from ' commit ' ;
diff --git a/mysql-test/suite/pbxt/r/ps_grant.result b/mysql-test/suite/pbxt/r/ps_grant.result
index 18e281703ef..4dbeb3c86d7 100644
--- a/mysql-test/suite/pbxt/r/ps_grant.result
+++ b/mysql-test/suite/pbxt/r/ps_grant.result
@@ -55,8 +55,7 @@ my_col
 execute s_t9 ;
 ERROR 42S02: Table 'mysqltest.t9' doesn't exist
 deallocate prepare s_t9;
-revoke all privileges on mysqltest.t1 from second_user@localhost
-identified by 'looser' ;
+revoke all privileges on mysqltest.t1 from second_user@localhost;
 show grants for second_user@localhost ;
 Grants for second_user@localhost
 GRANT USAGE ON *.* TO 'second_user'@'localhost' IDENTIFIED BY PASSWORD '*13843FE600B19A81E32AF50D4A6FED25875FF1F3'
diff --git a/mysql-test/suite/pbxt/r/rename.result b/mysql-test/suite/pbxt/r/rename.result
index 1257a668cce..66457b48145 100644
--- a/mysql-test/suite/pbxt/r/rename.result
+++ b/mysql-test/suite/pbxt/r/rename.result
@@ -55,14 +55,16 @@ t2
 t4
 drop table t2, t4;
 End of 4.1 tests
+#
+# Bug#14959: "ALTER TABLE isn't able to rename a view"
+# Bug#53976: "ALTER TABLE RENAME is allowed on views
+#             (not documented, broken)"
+#
 create table t1(f1 int);
 create view v1 as select * from t1;
 alter table v1 rename to v2;
-alter table v1 rename to v2;
-ERROR 42S02: Table 'test.v1' doesn't exist
-rename table v2 to v1;
-rename table v2 to v1;
-ERROR 42S01: Table 'v1' already exists
+ERROR HY000: 'test.v1' is not BASE TABLE
 drop view v1;
 drop table t1;
 End of 5.0 tests
+drop database pbxt;
diff --git a/mysql-test/suite/pbxt/r/schema.result b/mysql-test/suite/pbxt/r/schema.result
index 4167119d932..83aa7008b0e 100644
--- a/mysql-test/suite/pbxt/r/schema.result
+++ b/mysql-test/suite/pbxt/r/schema.result
@@ -11,5 +11,6 @@ foo
 mtr
 mysql
 pbxt
+performance_schema
 test
 drop schema foo;
diff --git a/mysql-test/suite/pbxt/r/select.result b/mysql-test/suite/pbxt/r/select.result
index c7601c00ee0..fee70103f25 100644
--- a/mysql-test/suite/pbxt/r/select.result
+++ b/mysql-test/suite/pbxt/r/select.result
@@ -185,37 +185,37 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	range	fld1	fld1	4	NULL	2	Using where; Using index
 select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
 fld1	fld3
-218401	faithful
+012001	flanking
+013602	foldout
+013606	fingerings
 018007	fanatic
-228311	fated
 018017	featherweight
-218022	feed
-088303	feminine
-058004	Fenton
-038017	fetched
 018054	fetters
-208101	fiftieth
-238007	filial
-013606	fingerings
-218008	finishers
-038205	firearm
-188505	fitting
-202301	Fitzpatrick
-238008	fixedly
-012001	flanking
 018103	flint
 018104	flopping
+036002	funereal
+038017	fetched
+038205	firearm
+058004	Fenton
+088303	feminine
+186002	freakish
 188007	flurried
-013602	foldout
+188505	fitting
+198006	furthermore
+202301	Fitzpatrick
+208101	fiftieth
+208113	freest
+218008	finishers
+218022	feed
+218401	faithful
 226205	foothill
-232102	forgivably
+226209	furnishings
 228306	forthcoming
-186002	freakish
-208113	freest
+228311	fated
 231315	freezes
-036002	funereal
-226209	furnishings
-198006	furthermore
+232102	forgivably
+238007	filial
+238008	fixedly
 select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
 fld3
 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
@@ -2092,10 +2092,10 @@ fld6	char(4)	latin1_swedish_ci	NO				#
 show full columns from t2 from test like 's%';
 Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
 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	1199	NULL	NULL		BTREE	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_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	1199	NULL	NULL		BTREE		
 drop table t4, t3, t2, t1;
 DO 1;
 DO benchmark(100,1+1),1,1;
@@ -2264,20 +2264,20 @@ a
 3
 select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
 a	a
-NULL	1
 1	2
-2	2
-3	2
 1	3
+2	2
 2	3
+3	2
 3	3
+NULL	1
 select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
 a	a
 2	1
-3	1
 2	2
-3	2
 2	3
+3	1
+3	2
 3	3
 select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
 a
@@ -2432,27 +2432,28 @@ city
 London
 DROP TABLE t1;
 create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
+insert into t1 values (1,0), (1,1), (18446744073709551615,0);
+Warnings:
+Warning	1264	Out of range value for column 'a' at row 3
 select a-b  from t1 order by 1;
 a-b
 0
 1
-18446744073709551615
+4294967295
 select a-b , (a-b < 0)  from t1 order by 1;
 a-b	(a-b < 0)
 0	0
 1	0
-18446744073709551615	0
+4294967295	0
 select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
 d	(a-b >= 0)	b
 1	1	0
 0	1	1
-18446744073709551615	1	2
 select cast((a - b) as unsigned) from t1 order by 1;
 cast((a - b) as unsigned)
 0
 1
-18446744073709551615
+4294967295
 drop table t1;
 create table t1 (a int(11));
 select all all * from t1;
@@ -2792,26 +2793,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.615800023078918
+0.6158000230789185
 select max(key2) from t2 where key2 <= 1.6158;
 max(key2)
-1.61580002307892
+1.6158000230789185
 select min(key1) from t1 where key1 >= 0.3762;
 min(key1)
-0.376199990510941
+0.37619999051094055
 select min(key2) from t2 where key2 >= 1.3762;
 min(key2)
-1.37619996070862
+1.3761999607086182
 select max(key1), min(key2) from t1, t2
 where key1 <= 0.6158 and key2 >= 1.3762;
 max(key1)	min(key2)
-0.615800023078918	1.37619996070862
+0.6158000230789185	1.3761999607086182
 select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
 max(key1)
-0.615800023078918
+0.6158000230789185
 select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
 min(key1)
-0.376199990510941
+0.37619999051094055
 DROP TABLE t1,t2;
 CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
 INSERT INTO t1 VALUES (10);
@@ -3241,37 +3242,37 @@ drop table t1, t2 ,t3;
 create table t1(f1 int, f2 date);
 insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
 (4,'2005-10-01'),(5,'2005-12-30');
-select * from t1 where f2 >= 0;
+select * from t1 where f2 >= 0            order by f2;
 f1	f2
 1	2005-01-01
 2	2005-09-01
 3	2005-09-30
 4	2005-10-01
 5	2005-12-30
-select * from t1 where f2 >= '0000-00-00';
+select * from t1 where f2 >= '0000-00-00' order by f2;
 f1	f2
 1	2005-01-01
 2	2005-09-01
 3	2005-09-30
 4	2005-10-01
 5	2005-12-30
-select * from t1 where f2 >= '2005-09-31';
+select * from t1 where f2 >= '2005-09-31' order by f2;
 f1	f2
 4	2005-10-01
 5	2005-12-30
-select * from t1 where f2 >= '2005-09-3a';
+select * from t1 where f2 >= '2005-09-3a' order by f2;
 f1	f2
 3	2005-09-30
 4	2005-10-01
 5	2005-12-30
 Warnings:
 Warning	1292	Incorrect date value: '2005-09-3a' for column 'f2' at row 1
-select * from t1 where f2 <= '2005-09-31';
+select * from t1 where f2 <= '2005-09-31' order by f2;
 f1	f2
 1	2005-01-01
 2	2005-09-01
 3	2005-09-30
-select * from t1 where f2 <= '2005-09-3a';
+select * from t1 where f2 <= '2005-09-3a' order by f2;
 f1	f2
 1	2005-01-01
 2	2005-09-01
@@ -3419,6 +3420,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	t2	const	PRIMARY	PRIMARY	4	const	1	
 1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	2	Using where
 DROP TABLE t1,t2;
+SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
 CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
 INSERT t1 SET i = 0;
 UPDATE t1 SET i = -1;
@@ -3438,8 +3440,9 @@ Warnings:
 Warning	1264	Out of range value for column 'i' at row 1
 SELECT * FROM t1;
 i
-255
+0
 DROP TABLE t1;
+SET SQL_MODE=default;
 create table t1 (a int);
 insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
 create table t2 (a int, b int, c int, e int, primary key(a,b,c));
@@ -3542,12 +3545,6 @@ id	a	b	c	d	e
 2	NULL	NULL	NULL	2	40
 2	NULL	NULL	NULL	2	50
 DROP TABLE t1,t2,t3;
-create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
-c7 int, c8 int, c9 int, fulltext key (`c1`)) engine=myisam;
-select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 
-from t1 where c9=1 order by c2, c2;
-match (`c1`) against ('z')	c2	c3	c4	c5	c6	c7	c8
-drop table t1;
 CREATE TABLE t1 (pk varchar(10) PRIMARY KEY, fk varchar(16));
 CREATE TABLE t2 (pk varchar(16) PRIMARY KEY, fk varchar(10));
 INSERT INTO t1 VALUES
diff --git a/mysql-test/suite/pbxt/r/select_safe.result b/mysql-test/suite/pbxt/r/select_safe.result
index 795d07bbc5f..06cff8609d7 100644
--- a/mysql-test/suite/pbxt/r/select_safe.result
+++ b/mysql-test/suite/pbxt/r/select_safe.result
@@ -1,5 +1,7 @@
 drop table if exists t1,t2;
 SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=4, SQL_MAX_JOIN_SIZE=9;
+Warnings:
+Warning	1287	The syntax '@@sql_max_join_size' is deprecated and will be removed in MySQL 7.0. Please use '@@max_join_size' instead
 create table t1 (a int auto_increment primary key, b char(20));
 insert into t1 values(1,"test");
 SELECT SQL_BUFFER_RESULT * from t1;
@@ -96,3 +98,5 @@ select * from (select 1 union select 2 union select 3) x;
 ERROR 42000: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if the SELECT is okay
 drop table t1;
 SET SQL_SAFE_UPDATES=0,SQL_SELECT_LIMIT=DEFAULT, SQL_MAX_JOIN_SIZE=DEFAULT;
+Warnings:
+Warning	1287	The syntax '@@sql_max_join_size' is deprecated and will be removed in MySQL 7.0. Please use '@@max_join_size' instead
diff --git a/mysql-test/suite/pbxt/r/status.result b/mysql-test/suite/pbxt/r/status.result
index 519a55301a3..797826049e0 100644
--- a/mysql-test/suite/pbxt/r/status.result
+++ b/mysql-test/suite/pbxt/r/status.result
@@ -1,11 +1,11 @@
 flush status;
 show status like 'Table_lock%';
 Variable_name	Value
-Table_locks_immediate	1
+Table_locks_immediate	0
 Table_locks_waited	0
 select * from information_schema.session_status where variable_name like 'Table_lock%';
 VARIABLE_NAME	VARIABLE_VALUE
-TABLE_LOCKS_IMMEDIATE	2
+TABLE_LOCKS_IMMEDIATE	0
 TABLE_LOCKS_WAITED	0
 SET SQL_LOG_BIN=0;
 drop table if exists t1;
@@ -21,11 +21,11 @@ update t1 set n = 3;
 unlock tables;
 show status like 'Table_lock%';
 Variable_name	Value
-Table_locks_immediate	17
+Table_locks_immediate	4
 Table_locks_waited	1
 select * from information_schema.session_status where variable_name like 'Table_lock%';
 VARIABLE_NAME	VARIABLE_VALUE
-TABLE_LOCKS_IMMEDIATE	18
+TABLE_LOCKS_IMMEDIATE	4
 TABLE_LOCKS_WAITED	1
 drop table t1;
 select 1;
@@ -100,7 +100,7 @@ Variable_name	Value
 Com_show_status	3
 show status like 'hand%write%';
 Variable_name	Value
-Handler_write	5
+Handler_write	0
 show status like '%tmp%';
 Variable_name	Value
 Created_tmp_disk_tables	0
@@ -108,7 +108,7 @@ Created_tmp_files	0
 Created_tmp_tables	0
 show status like 'hand%write%';
 Variable_name	Value
-Handler_write	7
+Handler_write	0
 show status like '%tmp%';
 Variable_name	Value
 Created_tmp_disk_tables	0
diff --git a/mysql-test/suite/pbxt/r/subselect.result b/mysql-test/suite/pbxt/r/subselect.result
index cfd459b4291..a9899f50670 100644
--- a/mysql-test/suite/pbxt/r/subselect.result
+++ b/mysql-test/suite/pbxt/r/subselect.result
@@ -50,7 +50,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 Warnings:
 Note	1276	Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
 Note	1276	Field or reference 'b.a' of SELECT #3 was resolved in SELECT #1
-Note	1003	select 1 AS `1` from (select 1 AS `a`) `b` having (<expr_cache><'1'>((select '1')) = 1)
+Note	1003	select 1 AS `1` from dual having (<expr_cache><'1'>((select '1')) = 1)
 SELECT 1 FROM (SELECT 1 as a) as b HAVING (SELECT a)=1;
 1
 1
@@ -203,7 +203,7 @@ id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 3	DERIVED	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
 2	SUBQUERY	t3	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where; Using filesort
 Warnings:
-Note	1003	select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
+Note	1003	select (select `test`.`t3`.`a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,'2' AS `a` from dual
 select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
 a
 2
@@ -731,11 +731,11 @@ id
 2
 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	PRIMARY	t2	ref	id	id	5	const	1	100.00	Using index
+1	PRIMARY	t2	ref	id	id	5	const	1	100.00	Using where; Using index
 Warnings:
 Note	1249	Select 3 was reduced during optimization
 Note	1249	Select 2 was reduced during optimization
-Note	1003	select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = (1 + 1))
+Note	1003	select `test`.`t2`.`id` AS `id` from `test`.`t2` where (`test`.`t2`.`id` = <cache>((1 + 1)))
 EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
 1	PRIMARY	t2	index	NULL	id	5	NULL	2	100.00	Using where; Using index
@@ -924,7 +924,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a')	(select c from t1 where a=t2.a)
 1	1	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b')	(select c from t1 where a=t2.a)
 1	0	a
@@ -934,7 +934,7 @@ select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t
 a	(select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c')	(select c from t1 where a=t2.a)
 1	0	a
 2	0	b
-NULL	0	NULL
+NULL	NULL	NULL
 drop table t1,t2;
 create table t1 (a int, b real, c varchar(10));
 insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
@@ -3571,9 +3571,7 @@ SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS
 (SELECT i FROM t1) UNION 
 (SELECT i FROM t1)
 );
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION 
-(SELECT i FROM t1)
-)' at line 3
+i
 SELECT * FROM t1 
 WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION (SELECT i FROM t1)))' at line 2
@@ -3583,7 +3581,11 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
 from t1' at line 1
 explain select * from t1 where not exists 
 ((select t11.i from t1 t11) union (select t12.i from t1 t12));
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'union (select t12.i from t1 t12))' at line 2
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	0	
+2	SUBQUERY	t11	ALL	NULL	NULL	NULL	NULL	0	
+3	UNION	t12	ALL	NULL	NULL	NULL	NULL	0	
+NULL	UNION RESULT	<union2,3>	ALL	NULL	NULL	NULL	NULL	NULL	
 DROP TABLE t1;
 CREATE TABLE t1 (a VARCHAR(250), b INT auto_increment, PRIMARY KEY (b));
 insert into t1 (a) values (FLOOR(rand() * 100));
@@ -3676,8 +3678,6 @@ CREATE TABLE t1 (a int, b int auto_increment, PRIMARY KEY (b));
 CREATE TABLE t2 (x int auto_increment, y int, z int,
 PRIMARY KEY (x), FOREIGN KEY (y) REFERENCES t1 (b));
 SET SESSION sort_buffer_size = 32 * 1024;
-Warnings:
-Warning	1292	Truncated incorrect sort_buffer_size value: '32768'
 SELECT SQL_NO_CACHE COUNT(*) 
 FROM (SELECT  a, b, (SELECT x FROM t2 WHERE y=b ORDER BY z DESC LIMIT 1) c
 FROM t1) t;
@@ -4288,8 +4288,15 @@ Note	1003	select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(e
 EXPLAIN EXTENDED
 SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION 
 (SELECT 1 FROM t2 WHERE t1.a = t2.a));
-ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION 
-(SELECT 1 FROM t2 WHERE t1.a = t2.a))' at line 2
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+2	DEPENDENT SUBQUERY	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+3	DEPENDENT UNION	t2	ALL	NULL	NULL	NULL	NULL	2	100.00	Using where
+NULL	UNION RESULT	<union2,3>	ALL	NULL	NULL	NULL	NULL	NULL	NULL	
+Warnings:
+Note	1276	Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
+Note	1276	Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
+Note	1003	select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
 DROP TABLE t1,t2;
 create table t1(f11 int, f12 int);
 create table t2(f21 int unsigned not null, f22 int, f23 varchar(10));
diff --git a/mysql-test/suite/pbxt/r/type_binary.result b/mysql-test/suite/pbxt/r/type_binary.result
index a83ebf5c25d..95b8841d9b1 100644
--- a/mysql-test/suite/pbxt/r/type_binary.result
+++ b/mysql-test/suite/pbxt/r/type_binary.result
@@ -47,7 +47,7 @@ create table t1 (s1 binary(2) primary key);
 insert into t1 values (0x01);
 insert into t1 values (0x0120);
 insert into t1 values (0x0100);
-ERROR 23000: Duplicate entry '' for key 'PRIMARY'
+ERROR 23000: Duplicate entry '\x01' for key 'PRIMARY'
 select hex(s1) from t1 order by s1;
 hex(s1)
 0100
diff --git a/mysql-test/suite/pbxt/r/type_bit.result b/mysql-test/suite/pbxt/r/type_bit.result
index c2969d00f74..b02516a630a 100644
--- a/mysql-test/suite/pbxt/r/type_bit.result
+++ b/mysql-test/suite/pbxt/r/type_bit.result
@@ -71,7 +71,7 @@ hex(a)
 1
 1
 alter table t1 add unique (a);
-ERROR 23000: Duplicate entry '' for key 'a'
+ERROR 23000: Duplicate entry '\x00' for key 'a'
 drop table t1;
 create table t1 (a bit(2));
 insert into t1 values (b'00'), (b'01'), (b'10'), (b'100');
diff --git a/mysql-test/suite/pbxt/r/type_decimal.result b/mysql-test/suite/pbxt/r/type_decimal.result
index a478a369404..b8f4ce1c241 100644
--- a/mysql-test/suite/pbxt/r/type_decimal.result
+++ b/mysql-test/suite/pbxt/r/type_decimal.result
@@ -3,13 +3,13 @@ SET SQL_WARNINGS=1;
 CREATE TABLE t1 (
 id int(11) NOT NULL auto_increment,
 datatype_id int(11) DEFAULT '0' NOT NULL,
-minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
-maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
+min_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
+max_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
 valuename varchar(20),
 forecolor int(11),
 backcolor int(11),
 PRIMARY KEY (id),
-UNIQUE datatype_id (datatype_id, minvalue, maxvalue)
+UNIQUE datatype_id (datatype_id, min_value, max_value)
 );
 INSERT INTO t1 VALUES ( '1', '4', '0.0000000000', '0.0000000000', 'Ei saja', '0', '16776960');
 INSERT INTO t1 VALUES ( '2', '4', '1.0000000000', '1.0000000000', 'Sajab', '16777215', '255');
@@ -143,12 +143,12 @@ INSERT INTO t1 VALUES ( '139', '21', '326.0000000000', '326.0000000000', 'Lumine
 INSERT INTO t1 VALUES ( '143', '16', '-4.9000000000', '-0.1000000000', '', NULL, '15774720');
 INSERT INTO t1 VALUES ( '145', '15', '0.0000000000', '1.9000000000', '', '0', '16769024');
 INSERT INTO t1 VALUES ( '146', '16', '0.0000000000', '1.9000000000', '', '0', '16769024');
-select * from t1 where minvalue<=1 and maxvalue>=-1 and datatype_id=16;
-id	datatype_id	minvalue	maxvalue	valuename	forecolor	backcolor
+select * from t1 where min_value<=1 and max_value>=-1 and datatype_id=16;
+id	datatype_id	min_value	max_value	valuename	forecolor	backcolor
 143	16	-4.9000000000	-0.1000000000		NULL	15774720
 146	16	0.0000000000	1.9000000000		0	16769024
-select * from t1 where minvalue<=-1 and maxvalue>=-1 and datatype_id=16;
-id	datatype_id	minvalue	maxvalue	valuename	forecolor	backcolor
+select * from t1 where min_value<=-1 and max_value>=-1 and datatype_id=16;
+id	datatype_id	min_value	max_value	valuename	forecolor	backcolor
 143	16	-4.9000000000	-0.1000000000		NULL	15774720
 drop table t1;
 create table t1 (a decimal(10,2));
@@ -683,6 +683,7 @@ select * from t1;
 a	b
 123.12345	123.1
 drop table t1;
+End of 4.1 tests
 CREATE TABLE t1
 (EMPNUM   CHAR(3) NOT NULL,
 HOURS    DECIMAL(5));
diff --git a/mysql-test/suite/pbxt/r/type_float.result b/mysql-test/suite/pbxt/r/type_float.result
index 4029909bce3..896708e7943 100644
--- a/mysql-test/suite/pbxt/r/type_float.result
+++ b/mysql-test/suite/pbxt/r/type_float.result
@@ -4,7 +4,7 @@ SELECT 10,10.0,10.,.1e+2,100.0e-1;
 10	10.0	10	10	10
 SELECT 6e-05, -6e-05, --6e-05, -6e-05+1.000000;
 6e-05	-6e-05	--6e-05	-6e-05+1.000000
-6e-05	-6e-05	6e-05	0.99994
+0.00006	-0.00006	0.00006	0.99994
 SELECT 1e1,1.e1,1.0e1,1e+1,1.e+1,1.0e+1,1e-1,1.e-1,1.0e-1;
 1e1	1.e1	1.0e1	1e+1	1.e+1	1.0e+1	1e-1	1.e-1	1.0e-1
 10	10	10	10	10	10	0.1	0.1	0.1
@@ -31,16 +31,16 @@ select * from t1;
 f1	f2
 10	10
 100000	100000
-1.23457e+09	1234567890
-1e+10	10000000000
-1e+15	1e+15
-1e+20	1e+20
-3.40282e+38	1e+50
-3.40282e+38	1e+150
+1234570000	1234567890
+10000000000	10000000000
+1e15	1e15
+1e20	1e20
+3.40282e38	1e50
+3.40282e38	1e150
 -10	-10
-1e-05	1e-05
-1e-10	1e-10
-1e-15	1e-15
+0.00001	0.00001
+0.0000000001	0.0000000001
+0.000000000000001	0.000000000000001
 1e-20	1e-20
 0	1e-50
 0	1e-150
@@ -87,7 +87,7 @@ col
 create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
 select * from t2;
 col1	col2	col3	col4
-140.36	121.00000	121	3.47850542618522e-07
+140.36	121.00000	121	0.00000034785054261852176
 show create table t2;
 Table	Create Table
 t2	CREATE TABLE `t2` (
@@ -201,9 +201,9 @@ insert into t1 values (2e5),(2e6),(2e-4),(2e-5);
 select * from t1;
 c
 200000
-2e+06
+2e6
 0.0002
-2e-05
+2e-5
 drop table t1;
 CREATE TABLE t1 (
 reckey int unsigned NOT NULL,
@@ -267,7 +267,7 @@ select 1e-308, 1.00000001e-300, 100000000e-300;
 1e-308	1.00000001e-300	1e-292
 select 10e307;
 10e307
-1e+308
+1e308
 End of 4.1 tests
 create table t1 (s1 float(0,2));
 ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 's1').
diff --git a/mysql-test/suite/pbxt/r/type_newdecimal.result b/mysql-test/suite/pbxt/r/type_newdecimal.result
index 4978a244c76..c51f073798a 100644
--- a/mysql-test/suite/pbxt/r/type_newdecimal.result
+++ b/mysql-test/suite/pbxt/r/type_newdecimal.result
@@ -185,7 +185,7 @@ select 1e10/0e0;
 1e10/0e0
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 create table wl1612 (col1 int, col2 decimal(38,10), col3 numeric(38,10));
 insert into wl1612 values(1,12345678901234567890.1234567890,12345678901234567890.1234567890);
 select * from wl1612;
@@ -205,27 +205,27 @@ NULL
 NULL
 NULL
 Warnings:
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
 select col2/0 from wl1612;
 col2/0
 NULL
 NULL
 NULL
 Warnings:
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
 select col3/0 from wl1612;
 col3/0
 NULL
 NULL
 NULL
 Warnings:
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
 insert into wl1612 values(5,5000.0005,5000.0005);
 insert into wl1612 values(6,5000.0005,5000.0005);
 select sum(col2),sum(col3) from wl1612;
@@ -788,12 +788,12 @@ select 1 / 1E-500;
 1 / 1E-500
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 select 1 / 0;
 1 / 0
 NULL
 Warnings:
-Error	1365	Division by 0
+Warning	1365	Division by 0
 set sql_mode='ansi,traditional';
 CREATE TABLE Sow6_2f (col1 NUMERIC(4,2));
 INSERT INTO Sow6_2f VALUES (10.55);
@@ -819,11 +819,11 @@ NULL
 NULL
 NULL
 Warnings:
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
-Error	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
+Warning	1365	Division by 0
 INSERT INTO Sow6_2f VALUES ('a59b');
 ERROR HY000: Incorrect decimal value: 'a59b' for column 'col1' at row 1
 drop table Sow6_2f;
@@ -838,12 +838,12 @@ select 9999999999999999999999999999999999999999999999999999999999999999999999999
 x
 99999999999999999999999999999999999999999999999999999999999999999
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 + 1 as x;
 x
 100000000000000000000000000000000000000000000000000000000000000000
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 select 0.190287977636363637 + 0.040372670 * 0 -  0;
 0.190287977636363637 + 0.040372670 * 0 -  0
 0.190287977636363637
@@ -917,7 +917,7 @@ cast('1.00000001335143196001808973960578441619873046875E-10' as decimal(30,15))
 0.000000000100000
 select ln(14000) c1, convert(ln(14000),decimal(5,3)) c2, cast(ln(14000) as decimal(5,3)) c3;
 c1	c2	c3
-9.5468126085974	9.547	9.547
+9.546812608597396	9.547	9.547
 select convert(ln(14000),decimal(2,3)) c1;
 ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '').
 select cast(ln(14000) as decimal(2,3)) c1;
@@ -1141,17 +1141,17 @@ my_float	my_double	my_varchar
 1.17549e-18	1.175494345e-18	1.175494345e-18
 1.17549e-17	1.175494345e-17	1.175494345e-17
 1.17549e-16	1.175494345e-16	1.175494345e-16
-1.17549e-15	1.175494345e-15	1.175494345e-15
-1.17549e-14	1.175494345e-14	1.175494345e-14
-1.17549e-13	1.175494345e-13	1.175494345e-13
-1.17549e-12	1.175494345e-12	1.175494345e-12
-1.17549e-11	1.175494345e-11	1.175494345e-11
-1.17549e-10	1.175494345e-10	1.175494345e-10
-1.17549e-09	1.175494345e-09	1.175494345e-9
-1.17549e-08	1.175494345e-08	1.175494345e-8
-1.17549e-07	1.175494345e-07	1.175494345e-7
-1.17549e-06	1.175494345e-06	1.175494345e-6
-1.17549e-05	1.175494345e-05	1.175494345e-5
+0.00000000000000117549	0.000000000000001175494345	1.175494345e-15
+0.0000000000000117549	0.00000000000001175494345	1.175494345e-14
+0.000000000000117549	0.0000000000001175494345	1.175494345e-13
+0.00000000000117549	0.000000000001175494345	1.175494345e-12
+0.0000000000117549	0.00000000001175494345	1.175494345e-11
+0.000000000117549	0.0000000001175494345	1.175494345e-10
+0.00000000117549	0.000000001175494345	1.175494345e-9
+0.0000000117549	0.00000001175494345	1.175494345e-8
+0.000000117549	0.0000001175494345	1.175494345e-7
+0.00000117549	0.000001175494345	1.175494345e-6
+0.0000117549	0.00001175494345	1.175494345e-5
 0.000117549	0.0001175494345	1.175494345e-4
 0.00117549	0.001175494345	1.175494345e-3
 0.0117549	0.01175494345	1.175494345e-2
@@ -1175,21 +1175,21 @@ CAST(my_float   AS DECIMAL(65,30))	my_float
 0.000000000000000001175494374380	1.17549e-18
 0.000000000000000011754943743802	1.17549e-17
 0.000000000000000117549432474939	1.17549e-16
-0.000000000000001175494324749389	1.17549e-15
-0.000000000000011754943671010360	1.17549e-14
-0.000000000000117549429933840000	1.17549e-13
-0.000000000001175494380653563000	1.17549e-12
-0.000000000011754943372854760000	1.17549e-11
-0.000000000117549428524377200000	1.17549e-10
-0.000000001175494368510499000000	1.17549e-09
-0.000000011754943685104990000000	1.17549e-08
-0.000000117549433298336200000000	1.17549e-07
-0.000001175494389826781000000000	1.17549e-06
-0.000011754943443520460000000000	1.17549e-05
+0.000000000000001175494324749389	0.00000000000000117549
+0.000000000000011754943671010362	0.0000000000000117549
+0.000000000000117549429933840040	0.000000000000117549
+0.000000000001175494380653563400	0.00000000000117549
+0.000000000011754943372854765000	0.0000000000117549
+0.000000000117549428524377220000	0.000000000117549
+0.000000001175494368510499000000	0.00000000117549
+0.000000011754943685104990000000	0.0000000117549
+0.000000117549433298336230000000	0.000000117549
+0.000001175494389826781100000000	0.00000117549
+0.000011754943443520460000000000	0.0000117549
 0.000117549432616215200000000000	0.000117549
-0.001175494398921728000000000000	0.00117549
-0.011754943057894710000000000000	0.0117549
-0.117549434304237400000000000000	0.117549
+0.001175494398921728100000000000	0.00117549
+0.011754943057894707000000000000	0.0117549
+0.117549434304237370000000000000	0.117549
 SELECT CAST(my_double  AS DECIMAL(65,30)), my_double FROM t1;
 CAST(my_double  AS DECIMAL(65,30))	my_double
 0.000000000000000000000000000000	1.175494345e-32
@@ -1209,17 +1209,17 @@ CAST(my_double  AS DECIMAL(65,30))	my_double
 0.000000000000000001175494345000	1.175494345e-18
 0.000000000000000011754943450000	1.175494345e-17
 0.000000000000000117549434500000	1.175494345e-16
-0.000000000000001175494345000000	1.175494345e-15
-0.000000000000011754943450000000	1.175494345e-14
-0.000000000000117549434500000000	1.175494345e-13
-0.000000000001175494345000000000	1.175494345e-12
-0.000000000011754943450000000000	1.175494345e-11
-0.000000000117549434500000000000	1.175494345e-10
-0.000000001175494345000000000000	1.175494345e-09
-0.000000011754943450000000000000	1.175494345e-08
-0.000000117549434500000000000000	1.175494345e-07
-0.000001175494345000000000000000	1.175494345e-06
-0.000011754943450000000000000000	1.175494345e-05
+0.000000000000001175494345000000	0.000000000000001175494345
+0.000000000000011754943450000000	0.00000000000001175494345
+0.000000000000117549434500000000	0.0000000000001175494345
+0.000000000001175494345000000000	0.000000000001175494345
+0.000000000011754943450000000000	0.00000000001175494345
+0.000000000117549434500000000000	0.0000000001175494345
+0.000000001175494345000000000000	0.000000001175494345
+0.000000011754943450000000000000	0.00000001175494345
+0.000000117549434500000000000000	0.0000001175494345
+0.000001175494345000000000000000	0.000001175494345
+0.000011754943450000000000000000	0.00001175494345
 0.000117549434500000000000000000	0.0001175494345
 0.001175494345000000000000000000	0.001175494345
 0.011754943450000000000000000000	0.01175494345
@@ -1278,26 +1278,26 @@ my_decimal	my_float
 0.000000000000000001175494374380	1.17549e-18
 0.000000000000000011754943743802	1.17549e-17
 0.000000000000000117549432474939	1.17549e-16
-0.000000000000001175494324749389	1.17549e-15
-0.000000000000011754943671010360	1.17549e-14
-0.000000000000117549429933840000	1.17549e-13
-0.000000000001175494380653563000	1.17549e-12
-0.000000000011754943372854760000	1.17549e-11
-0.000000000117549428524377200000	1.17549e-10
-0.000000001175494368510499000000	1.17549e-09
-0.000000011754943685104990000000	1.17549e-08
-0.000000117549433298336200000000	1.17549e-07
-0.000001175494389826781000000000	1.17549e-06
-0.000011754943443520460000000000	1.17549e-05
+0.000000000000001175494324749389	0.00000000000000117549
+0.000000000000011754943671010362	0.0000000000000117549
+0.000000000000117549429933840040	0.000000000000117549
+0.000000000001175494380653563400	0.00000000000117549
+0.000000000011754943372854765000	0.0000000000117549
+0.000000000117549428524377220000	0.000000000117549
+0.000000001175494368510499000000	0.00000000117549
+0.000000011754943685104990000000	0.0000000117549
+0.000000117549433298336230000000	0.000000117549
+0.000001175494389826781100000000	0.00000117549
+0.000011754943443520460000000000	0.0000117549
 0.000117549432616215200000000000	0.000117549
-0.001175494398921728000000000000	0.00117549
-0.011754943057894710000000000000	0.0117549
-0.117549434304237400000000000000	0.117549
+0.001175494398921728100000000000	0.00117549
+0.011754943057894707000000000000	0.0117549
+0.117549434304237370000000000000	0.117549
 UPDATE t1 SET my_decimal = my_double;
-SELECT my_decimal, my_double  FROM t1 order by my_decimal;
+SELECT my_decimal, my_double  FROM t1;
 my_decimal	my_double
-0.000000000000000000000000000000	1.175494345e-32
 0.000000000000000000000000000000	1.175494345e-31
+0.000000000000000000000000000000	1.175494345e-32
 0.000000000000000000000000000001	1.175494345e-30
 0.000000000000000000000000000012	1.175494345e-29
 0.000000000000000000000000000118	1.175494345e-28
@@ -1313,23 +1313,23 @@ my_decimal	my_double
 0.000000000000000001175494345000	1.175494345e-18
 0.000000000000000011754943450000	1.175494345e-17
 0.000000000000000117549434500000	1.175494345e-16
-0.000000000000001175494345000000	1.175494345e-15
-0.000000000000011754943450000000	1.175494345e-14
-0.000000000000117549434500000000	1.175494345e-13
-0.000000000001175494345000000000	1.175494345e-12
-0.000000000011754943450000000000	1.175494345e-11
-0.000000000117549434500000000000	1.175494345e-10
-0.000000001175494345000000000000	1.175494345e-09
-0.000000011754943450000000000000	1.175494345e-08
-0.000000117549434500000000000000	1.175494345e-07
-0.000001175494345000000000000000	1.175494345e-06
-0.000011754943450000000000000000	1.175494345e-05
+0.000000000000001175494345000000	0.000000000000001175494345
+0.000000000000011754943450000000	0.00000000000001175494345
+0.000000000000117549434500000000	0.0000000000001175494345
+0.000000000001175494345000000000	0.000000000001175494345
+0.000000000011754943450000000000	0.00000000001175494345
+0.000000000117549434500000000000	0.0000000001175494345
+0.000000001175494345000000000000	0.000000001175494345
+0.000000011754943450000000000000	0.00000001175494345
+0.000000117549434500000000000000	0.0000001175494345
+0.000001175494345000000000000000	0.000001175494345
+0.000011754943450000000000000000	0.00001175494345
 0.000117549434500000000000000000	0.0001175494345
 0.001175494345000000000000000000	0.001175494345
 0.011754943450000000000000000000	0.01175494345
 0.117549434500000000000000000000	0.1175494345
 UPDATE t1 SET my_decimal = my_varchar;
-SELECT my_decimal, my_varchar FROM t1 order by my_decimal, my_varchar;
+SELECT my_decimal, my_varchar FROM t1;
 my_decimal	my_varchar
 0.000000000000000000000000000000	1.175494345e-31
 0.000000000000000000000000000000	1.175494345e-32
@@ -1368,16 +1368,12 @@ create table t1 (c1 decimal(64));
 insert into t1 values(
 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
 Warning	1264	Out of range value for column 'c1' at row 1
 insert into t1 values(
 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
-Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Error	1292	Truncated incorrect DECIMAL value: ''
-Warning	1264	Out of range value for column 'c1' at row 1
+ERROR 22003: DECIMAL value is out of range in '(99999999999999999999999999999999999999999999999999999999999999999 * 99999999999999999999999999999999999999999999999999999999999999999)'
 insert into t1 values(1e100);
 Warnings:
 Warning	1264	Out of range value for column 'c1' at row 1
@@ -1385,7 +1381,6 @@ select * from t1;
 c1
 9999999999999999999999999999999999999999999999999999999999999999
 9999999999999999999999999999999999999999999999999999999999999999
-9999999999999999999999999999999999999999999999999999999999999999
 drop table t1;
 create table t1(a decimal(7,2));
 insert into t1 values(123.12);
@@ -1426,7 +1421,7 @@ select cast(143.481 as decimal(2,1));
 cast(143.481 as decimal(2,1))
 9.9
 Warnings:
-Error	1264	Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1
+Warning	1264	Out of range value for column 'cast(143.481 as decimal(2,1))' at row 1
 select cast(-3.4 as decimal(2,1));
 cast(-3.4 as decimal(2,1))
 -3.4
@@ -1434,12 +1429,12 @@ select cast(99.6 as decimal(2,0));
 cast(99.6 as decimal(2,0))
 99
 Warnings:
-Error	1264	Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1
+Warning	1264	Out of range value for column 'cast(99.6 as decimal(2,0))' at row 1
 select cast(-13.4 as decimal(2,1));
 cast(-13.4 as decimal(2,1))
 -9.9
 Warnings:
-Error	1264	Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
+Warning	1264	Out of range value for column 'cast(-13.4 as decimal(2,1))' at row 1
 select cast(98.6 as decimal(2,0));
 cast(98.6 as decimal(2,0))
 99
@@ -1447,4 +1442,4 @@ select cast(19999999999999999999 as unsigned);
 cast(19999999999999999999 as unsigned)
 18446744073709551615
 Warnings:
-Error	1292	Truncated incorrect DECIMAL value: ''
+Warning	1292	Truncated incorrect DECIMAL value: ''
diff --git a/mysql-test/suite/pbxt/r/type_ranges.result b/mysql-test/suite/pbxt/r/type_ranges.result
index 0674dcb4d28..d5858c190d1 100644
--- a/mysql-test/suite/pbxt/r/type_ranges.result
+++ b/mysql-test/suite/pbxt/r/type_ranges.result
@@ -68,21 +68,21 @@ longblob_col	longblob	NULL	NO		NULL		#
 options	enum('one','two','tree')	latin1_swedish_ci	NO	MUL	NULL		#	
 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	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	
+Table	Non_unique	Key_name	Seq_in_index	Column_name	Collation	Cardinality	Sub_part	Packed	Null	Index_type	Comment	Index_comment
+t1	0	PRIMARY	1	auto	A	0	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 ) ;
@@ -271,13 +271,13 @@ drop table t2;
 create table t2 (primary key (auto)) select auto+1 as auto,1 as t1, 'a' as t2, repeat('a',256) as t3, binary repeat('b',256) as t4, repeat('a',4096) as t5, binary repeat('b',4096) as t6, '' as t7, binary '' as t8 from t1;
 show full columns from t2;
 Field	Type	Collation	Null	Key	Default	Extra	Privileges	Comment
-auto	bigint(12) unsigned	NULL	NO	PRI	0		#	
+auto	int(11) unsigned	NULL	NO	PRI	0		#	
 t1	int(1)	NULL	NO		0		#	
 t2	varchar(1)	latin1_swedish_ci	NO				#	
 t3	varchar(256)	latin1_swedish_ci	NO				#	
 t4	varbinary(256)	NULL	NO				#	
-t5	longtext	latin1_swedish_ci	NO		NULL		#	
-t6	longblob	NULL	NO		NULL		#	
+t5	text	latin1_swedish_ci	NO		NULL		#	
+t6	blob	NULL	NO		NULL		#	
 t7	char(0)	latin1_swedish_ci	NO				#	
 t8	binary(0)	NULL	NO				#	
 select t1,t2,length(t3),length(t4),length(t5),length(t6),t7,t8 from t2;
diff --git a/mysql-test/suite/pbxt/r/type_timestamp.result b/mysql-test/suite/pbxt/r/type_timestamp.result
index b04dcf01b9c..b5b38fad3e4 100644
--- a/mysql-test/suite/pbxt/r/type_timestamp.result
+++ b/mysql-test/suite/pbxt/r/type_timestamp.result
@@ -97,30 +97,6 @@ date	date_time	time_stamp
 2005-01-01	2005-01-01 00:00:00	2005-01-01 00:00:00
 2030-01-01	2030-01-01 00:00:00	2030-01-01 00:00:00
 drop table t1;
-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	'TIMESTAMP(2)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(4)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(6)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(8)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(10)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(12)' is deprecated and will be removed in a future release. Please use 'TIMESTAMP' instead
-Warning	1287	'TIMESTAMP(14)' is deprecated and will be removed in a future release. 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",
-"1997-12-31 23:47:59");
-select * from t1;
-t2	t4	t6	t8	t10	t12	t14
-0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00
-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	1997-12-31 23:47:59
-select * from t1;
-t2	t4	t6	t8	t10	t12	t14
-0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00	0000-00-00 00:00:00
-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	1997-12-31 23:47:59
-drop table t1;
 create table t1 (ix timestamp);
 insert into t1 values (0),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101),(20031200000000),(20030000000000);
 Warnings:
@@ -436,7 +412,7 @@ max(t)
 2004-02-01 00:00:00
 drop table t1;
 set sql_mode='maxdb';
-create table t1 (a timestamp, b timestamp(19));
+create table t1 (a timestamp, b timestamp);
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE "t1" (
diff --git a/mysql-test/suite/pbxt/r/union.result b/mysql-test/suite/pbxt/r/union.result
index 2d90250157d..ab34df29cbb 100644
--- a/mysql-test/suite/pbxt/r/union.result
+++ b/mysql-test/suite/pbxt/r/union.result
@@ -428,7 +428,7 @@ ERROR 42000: Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'
 create temporary table t1 engine=myisam select a from t1 union select a from t2;
 drop temporary table t1;
 create table t1 select a from t1 union select a from t2;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+ERROR 42S01: Table 't1' already exists
 select a from t1 union select a from t2 order by t2.a;
 ERROR 42S22: Unknown column 't2.a' in 'order clause'
 drop table t1,t2;
@@ -554,7 +554,7 @@ aa
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `a` varbinary(2) NOT NULL DEFAULT ''
+  `a` varchar(2) NOT NULL DEFAULT ''
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT 12 as a UNION select 12.2 as a;
@@ -655,7 +655,7 @@ f
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `f` varbinary(12) DEFAULT NULL
+  `f` varchar(12) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT y from t2 UNION select da from t2;
@@ -666,7 +666,7 @@ y
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `y` varbinary(10) DEFAULT NULL
+  `y` varchar(10) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT y from t2 UNION select dt from t2;
@@ -677,7 +677,7 @@ y
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `y` varbinary(19) DEFAULT NULL
+  `y` varchar(19) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT da from t2 UNION select dt from t2;
@@ -699,7 +699,7 @@ testc
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `dt` varbinary(19) DEFAULT NULL
+  `dt` varchar(19) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT dt from t2 UNION select sv from t2;
@@ -710,7 +710,7 @@ testv
 show create table t1;
 Table	Create Table
 t1	CREATE TABLE `t1` (
-  `dt` varbinary(19) DEFAULT NULL
+  `dt` varchar(19) DEFAULT NULL
 ) ENGINE=PBXT DEFAULT CHARSET=latin1
 drop table t1;
 create table t1 SELECT sc from t2 UNION select sv from t2;
@@ -1305,6 +1305,8 @@ SELECT @tmp_max:= @@global.max_allowed_packet;
 @tmp_max:= @@global.max_allowed_packet
 1048576
 SET @@global.max_allowed_packet=25000000;
+Warnings:
+Warning	1292	Truncated incorrect max_allowed_packet value: '25000000'
 CREATE TABLE t1 (a mediumtext);
 CREATE TABLE t2 (b varchar(20));
 INSERT INTO t1 VALUES ('a');
diff --git a/mysql-test/suite/pbxt/r/update.result b/mysql-test/suite/pbxt/r/update.result
index 9154583fa81..13d50071bfd 100644
--- a/mysql-test/suite/pbxt/r/update.result
+++ b/mysql-test/suite/pbxt/r/update.result
@@ -273,6 +273,7 @@ show status like 'handler_read%';
 Variable_name	Value
 Handler_read_first	1
 Handler_read_key	0
+Handler_read_last	0
 Handler_read_next	0
 Handler_read_prev	0
 Handler_read_rnd	0
@@ -287,30 +288,33 @@ show status like 'handler_read%';
 Variable_name	Value
 Handler_read_first	0
 Handler_read_key	0
+Handler_read_last	1
 Handler_read_next	0
 Handler_read_prev	0
 Handler_read_rnd	2
-Handler_read_rnd_next	18
+Handler_read_rnd_next	9
 flush status;
 delete from t1 order by a limit 1;
 show status like 'handler_read%';
 Variable_name	Value
-Handler_read_first	0
+Handler_read_first	1
 Handler_read_key	0
+Handler_read_last	0
 Handler_read_next	0
 Handler_read_prev	0
-Handler_read_rnd	1
-Handler_read_rnd_next	9
+Handler_read_rnd	0
+Handler_read_rnd_next	0
 flush status;
 delete from t1 order by a desc limit 1;
 show status like 'handler_read%';
 Variable_name	Value
 Handler_read_first	0
 Handler_read_key	0
+Handler_read_last	1
 Handler_read_next	0
 Handler_read_prev	0
-Handler_read_rnd	1
-Handler_read_rnd_next	8
+Handler_read_rnd	0
+Handler_read_rnd_next	0
 alter table t1 disable keys;
 Warnings:
 Note	1031	Table storage engine for 't1' doesn't have this option
@@ -318,12 +322,13 @@ flush status;
 delete from t1 order by a limit 1;
 show status like 'handler_read%';
 Variable_name	Value
-Handler_read_first	0
+Handler_read_first	1
 Handler_read_key	0
+Handler_read_last	0
 Handler_read_next	0
 Handler_read_prev	0
-Handler_read_rnd	1
-Handler_read_rnd_next	7
+Handler_read_rnd	0
+Handler_read_rnd_next	0
 select * from t1;
 a	b
 0	0
@@ -373,6 +378,7 @@ show status like 'handler_read%';
 Variable_name	Value
 Handler_read_first	0
 Handler_read_key	1
+Handler_read_last	0
 Handler_read_next	1
 Handler_read_prev	0
 Handler_read_rnd	1
diff --git a/mysql-test/suite/pbxt/r/user_var.result b/mysql-test/suite/pbxt/r/user_var.result
index f932ba4d86b..b6ba2522719 100644
--- a/mysql-test/suite/pbxt/r/user_var.result
+++ b/mysql-test/suite/pbxt/r/user_var.result
@@ -192,8 +192,6 @@ coercibility(@v1)	coercibility(@v2)	coercibility(@v3)	coercibility(@v4)
 2	2	2	2
 set session @honk=99;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@honk=99' at line 1
-set one_shot @honk=99;
-ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
 select @@local.max_allowed_packet;
 @@local.max_allowed_packet
 #
diff --git a/mysql-test/suite/pbxt/r/view_grant.result b/mysql-test/suite/pbxt/r/view_grant.result
index f66ff458761..1caac220ba8 100644
--- a/mysql-test/suite/pbxt/r/view_grant.result
+++ b/mysql-test/suite/pbxt/r/view_grant.result
@@ -16,7 +16,7 @@ create table mysqltest.t2 (a int, b int);
 grant select on mysqltest.t1 to mysqltest_1@localhost;
 grant create view,select on test.* to mysqltest_1@localhost;
 create definer=root@localhost view v1 as select * from mysqltest.t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 create view v1 as select * from mysqltest.t1;
 alter view v1 as select * from mysqltest.t1;
 ERROR 42000: DROP command denied to user 'mysqltest_1'@'localhost' for table 'v1'
@@ -469,6 +469,7 @@ use test;
 REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
 drop database mysqltest;
 drop view if exists v1;
+drop table if exists t1;
 create table t1 as select * from mysql.user where user='';
 delete from mysql.user where user='';
 flush privileges;
@@ -778,18 +779,18 @@ GRANT CREATE VIEW ON db26813.v2 TO u26813@localhost;
 GRANT DROP, CREATE VIEW ON db26813.v3 TO u26813@localhost;
 GRANT SELECT ON db26813.t1 TO u26813@localhost;
 ALTER VIEW v1 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: CREATE VIEW command denied to user 'u26813'@'localhost' for table 'v1'
 ALTER VIEW v2 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: DROP command denied to user 'u26813'@'localhost' for table 'v2'
 ALTER VIEW v3 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SHOW CREATE VIEW v3;
 View	Create View	character_set_client	collation_connection
 v3	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`f1` AS `f1` from `t1`	latin1	latin1_swedish_ci
 DROP USER u26813@localhost;
 DROP DATABASE db26813;
 #
-# Bug#29908: A user can gain additional access through the ALTER VIEW.
+# Bug#29908 A user can gain additional access through the ALTER VIEW.
 #
 CREATE DATABASE mysqltest_29908;
 USE mysqltest_29908;
@@ -798,17 +799,17 @@ CREATE USER u29908_1@localhost;
 CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
 CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
 SELECT f1 FROM t1;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
 GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
 CREATE USER u29908_2@localhost;
-GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
+GRANT SELECT, DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
 GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
 ALTER VIEW v1 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 ALTER VIEW v2 AS SELECT f2 FROM t1;
-ERROR 42000: Access denied; you need the SUPER privilege for this operation
+ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
 SHOW CREATE VIEW v2;
 View	Create View	character_set_client	collation_connection
 v2	CREATE ALGORITHM=UNDEFINED DEFINER=`u29908_1`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select `t1`.`f1` AS `f1` from `t1`	latin1	latin1_swedish_ci
diff --git a/mysql-test/suite/pbxt/t/constraints.test b/mysql-test/suite/pbxt/t/constraints.test
index 565c8890f69..520af3e5a96 100644
--- a/mysql-test/suite/pbxt/t/constraints.test
+++ b/mysql-test/suite/pbxt/t/constraints.test
@@ -10,7 +10,7 @@ create table t1 (a int check (a>0));
 insert into t1 values (1);
 insert into t1 values (0);
 drop table t1;
-create table t1 (a int ,b int, check a>b);
+create table t1 (a int, b int, check (a>b));
 insert into t1 values (1,0);
 insert into t1 values (0,1);
 drop table t1;
diff --git a/mysql-test/suite/pbxt/t/create.test b/mysql-test/suite/pbxt/t/create.test
index 07ad03d4bfb..e5271515cfc 100644
--- a/mysql-test/suite/pbxt/t/create.test
+++ b/mysql-test/suite/pbxt/t/create.test
@@ -5,6 +5,7 @@
 --disable_warnings
 drop table if exists t1,t2,t3,t4,t5;
 drop database if exists mysqltest;
+drop view if exists v1;
 --enable_warnings
 
 create table t1 (b char(0));
@@ -101,6 +102,22 @@ create table t1 (`` int);
 --error 1280
 create table t1 (i int, index `` (i)); 
 
+#
+# CREATE TABLE under LOCK TABLES
+#
+# We don't allow creation of non-temporary tables under LOCK TABLES
+# as following meta-data locking protocol in this case can lead to
+# deadlock.
+create table t1 (i int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 (j int);
+# OTOH creating of temporary table should be OK
+create temporary table t2 (j int);
+drop temporary table t2;
+unlock tables;
+drop table t1;
+
 #
 # Test of CREATE ... SELECT with indexes
 #
@@ -216,7 +233,6 @@ drop table t1;
 
 create table t1 select 1,2,3;
 create table if not exists t1 select 1,2;
---error 1136
 create table if not exists t1 select 1,2,3,4;
 create table if not exists t1 select 1;
 select * from t1;
@@ -232,8 +248,6 @@ insert into t1 values (1,1);
 create table if not exists t1 select 2;
 select * from t1;
 create table if not exists t1 select 3 as 'a',4 as 'b';
---error ER_DUP_ENTRY
-create table if not exists t1 select 3 as 'a',3 as 'b';
 show warnings;
 show status like "Opened_tables";
 select * from t1;
@@ -295,7 +309,6 @@ show create table t3;
 select * from t3;
 drop table t2, t3;
 create database mysqltest;
-alter table t1;
 create table mysqltest.t3 like t1;
 create temporary table t3 like mysqltest.t3;
 show create table t3;
@@ -315,6 +328,26 @@ drop table t1, t2, t3;
 drop table t3;
 drop database mysqltest;
 
+#
+# CREATE TABLE LIKE under LOCK TABLES
+#
+# Similarly to ordinary CREATE TABLE we don't allow creation of
+# non-temporary tables under LOCK TABLES. Also we require source
+# table to be locked.
+create table t1 (i int);
+create table t2 (j int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t3 like t1;
+# OTOH creating of temporary table should be OK
+create temporary table t3 like t1;
+drop temporary table t3;
+# Source table should be locked
+--error ER_TABLE_NOT_LOCKED
+create temporary table t3 like t2;
+unlock tables;
+drop tables t1, t2;
+
 #
 # Test default table type
 #
@@ -482,9 +515,9 @@ drop table t1,t2;
 # an improper fix is present.
 #
 create table t1 (a int);
---error 1093
+--error ER_TABLE_EXISTS_ERROR
 create table t1 select * from t1;
---error 1347
+--error ER_WRONG_OBJECT
 create table t2 union = (t1) select * from t1;
 flush tables with read lock;
 unlock tables;
@@ -661,6 +694,7 @@ create table t1(a set("a,b","c,d") not null);
 
 # End of 4.1 tests
 
+
 #
 # Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
 # platforms
@@ -673,13 +707,543 @@ alter table t1 max_rows=100000000000;
 show create table t1;
 drop table t1;
 
+
+#
+# Tests for errors happening at various stages of CREATE TABLES ... SELECT
+#
+# (Also checks that it behaves atomically in the sense that in case
+#  of error it is automatically dropped if it has not existed before.)
+#
+# Error during open_and_lock_tables() of tables
+--error ER_NO_SUCH_TABLE
+create table t1 select * from t2;
+# A special case which is also caught during open tables pahse
+--error ER_NO_SUCH_TABLE
+create table t1 select * from t1;
+# Error which happens before select_create::prepare()
+--error ER_CANT_AGGREGATE_2COLLATIONS
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+# Error during table creation
+--error ER_KEY_COLUMN_DOES_NOT_EXITS
+create table t1 (primary key(a)) select "b" as b;
+# Error in select_create::prepare() which is not related to table creation
+create table t1 (a int);
+create table if not exists t1 select 1 as a, 2 as b;
+drop table t1;
+# Finally error which happens during insert
+--error ER_DUP_ENTRY
+create table t1 (primary key (a)) (select 1 as a) union all (select 1 as a);
+# What happens if table already exists ?
+create table t1 (i int);
+--error ER_TABLE_EXISTS_ERROR
+create table t1 select 1 as i;
+create table if not exists t1 select 1 as i;
+select * from t1;
+# After WL#5370, it just generates a warning that the table already exists.
+create table if not exists t1 select * from t1;
+select * from t1;
+drop table t1;
+# Error before select_create::prepare()
+--error ER_CANT_AGGREGATE_2COLLATIONS
+create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin);
+
+
+# Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent
+# results of CREATE TABLE ... SELECT when temporary table exists").
+# In this situation we either have to create non-temporary table and
+# insert data in it or insert data in temporary table without creation of
+# permanent table. After patch for Bug#47418, we create the base table and
+# instert data into it, even though a temporary table exists with the same
+# name.
+create temporary table t1 (j int);
+create table if not exists t1 select 1;
+select * from t1;
+drop temporary table t1;
+select * from t1;
+drop table t1;
+
+
+#
+# CREATE TABLE ... SELECT and LOCK TABLES
+#
+# There is little sense in using CREATE TABLE ... SELECT under
+# LOCK TABLES as it mostly does not work. At least we check that
+# the server doesn't crash, hang and produces sensible errors.
+# Includes test for bug #20662 "Infinite loop in CREATE TABLE
+# IF NOT EXISTS ... SELECT with locked tables".
+create table t1 (i int);
+insert into t1 values (1), (2);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED
+create table if not exists t2 select * from t1;
+unlock tables;
+create table t2 (j int);
+lock tables t1 read;
+--error ER_TABLE_NOT_LOCKED
+create table t2 select * from t1;
+# This should not be ever allowed as it will undermine
+# lock-all-at-once approach
+--error ER_TABLE_NOT_LOCKED
+create table if not exists t2 select * from t1;
+unlock tables;
+lock table t1 read, t2 read;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create table t2 select * from t1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+create table if not exists t2 select * from t1;
+unlock tables;
+lock table t1 read, t2 write;
+--error ER_TABLE_EXISTS_ERROR
+create table t2 select * from t1;
+# This is the only case which really works.
+create table if not exists t2 select * from t1;
+select * from t1;
+unlock tables;
+drop table t2;
+
+# OTOH CREATE TEMPORARY TABLE ... SELECT should work
+# well under LOCK TABLES.
+lock tables t1 read;
+create temporary table t2 select * from t1;
+create temporary table if not exists t2 select * from t1;
+select * from t2;
+unlock tables;
+drop table t1, t2;
+
+
 #
 # Bug#21772: can not name a column 'upgrade' when create a table
 #
 create table t1 (upgrade int);
 drop table t1;
 
-# End of 5.0 tests
+
+#
+# Bug #26642: create index corrupts table definition in .frm
+#
+# Problem with creating keys with maximum key-parts and maximum name length
+# This test is made for a mysql server supporting names up to 64 bytes
+# and a maximum of 16 key segements per Key
+#
+
+create table t1 (
+  c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int,
+  c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int,
+
+ key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16)
+);
+
+# Check that the table is not corrupted
+show create table t1;
+flush tables;
+show create table t1;
+
+# Repeat test using ALTER to add indexes
+
+drop table t1;
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, 
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int);
+
+alter table t1
+
+ add key a001_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a002_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a003_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a004_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a005_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a006_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a007_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a008_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a009_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a010_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a011_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a012_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a013_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a014_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a015_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a016_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a017_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a018_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a019_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a020_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a021_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a022_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a023_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a024_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a025_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a026_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a027_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a028_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a029_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a030_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a031_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a032_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a033_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a034_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a035_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a036_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a037_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a038_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a039_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a040_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a041_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a042_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a043_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a044_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a045_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a046_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a047_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a048_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a049_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a050_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a051_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a052_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a053_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a054_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a055_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a056_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a057_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a058_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a059_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+
+ add key a060_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a061_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a062_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a063_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16),
+ add key a064_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+
+show create table t1;
+flush tables;
+show create table t1;
+
+# Test the server limits; if any of these pass, all above tests need
+# to be rewritten to hit the limit
+#
+# Ensure limit is really 64 keys
+--error 1069
+alter table t1 add key 
+ a065_long_123456789_123456789_123456789_123456789_123456789_1234 (
+  c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16);
+
+drop table t1;
+
+# Ensure limit is really 16 key parts per key
+
+create table t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, 
+c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, 
+c16 int, c17 int, c18 int,c19 int,c20 int,c21 int,c22 int,c23 int,c24 int,c25 int,c26 int,c27 int,c28 int,c29 int,c30 int,c31 int,c32 int, c33 int);
+
+# Get error for max key parts
+--error 1070
+alter table t1 add key i1 (
+ c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16, c17,c18,c19,c20,c21,c22,c23,c24,c25,c26,c27,c28,c29,c30,c31,c32,c33);
+
+# Get error for max key-name length
+--error 1059
+alter table t1 add key 
+ a001_long_123456789_123456789_123456789_123456789_123456789_12345 (c1);
+
+show create table t1;
+
+drop table t1;
+
+--echo
+--echo Bug #26104 Bug on foreign key class constructor
+--echo
+--echo Check that ref_columns is initalized correctly in the constructor
+--echo and semantic checks in mysql_prepare_table work.
+--echo
+--echo We do not need a storage engine that supports foreign keys
+--echo for this test, as the checks are purely syntax-based, and the
+--echo syntax is supported for all engines.
+--echo
+--disable_warnings
+drop table if exists t1,t2;
+--enable_warnings
+
+create table t1(a int not null, b int not null, primary key (a, b));
+--error ER_WRONG_FK_DEF
+create table t2(a int not null, b int not null, c int not null, primary key (a),
+foreign key fk_bug26104 (b,c) references t1(a));
+drop table t1;
+
+#
+# Bug#15130:CREATE .. SELECT was denied to use advantages of the SQL_BIG_RESULT.
+#
+create table t1(f1 int,f2 int);
+insert into t1 value(1,1),(1,2),(1,3),(2,1),(2,2),(2,3);
+flush status;
+create table t2 select sql_big_result f1,count(f2) from t1 group by f1;
+show status like 'handler_read%';
+drop table t1,t2;
+
+#
+# Bug #25162: Backing up DB from 5.1 adds 'USING BTREE' to KEYs on table creates
+#
+
+# Show that the old syntax for index type is supported
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1));
+DROP TABLE t1;
+
+# Show that the new syntax for index type is supported
+CREATE TABLE t1(c1 VARCHAR(33), KEY (c1) USING BTREE);
+DROP TABLE t1;
+
+# Show that in case of multiple index type definitions, the last one takes 
+# precedence
+
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING BTREE (c1) USING HASH) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1(c1 VARCHAR(33), KEY USING HASH (c1) USING BTREE) ENGINE=MEMORY;
+SHOW INDEX FROM t1;
+DROP TABLE t1;
+
+#
+# Bug#35924 DEFINER should be stored 'quoted' in I_S
+#
+--error ER_UNKNOWN_ERROR
+create user mysqltest_1@'test@test';
+
+#
+# Bug#38821: Assert table->auto_increment_field_not_null failed in open_table()
+#
+CREATE TABLE t1 (a INTEGER AUTO_INCREMENT PRIMARY KEY, b INTEGER NOT NULL);
+INSERT IGNORE INTO t1 (b) VALUES (5);
+
+CREATE TABLE IF NOT EXISTS t2 (a INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY)
+  SELECT a FROM t1;
+--error 1062
+INSERT INTO t2 SELECT a FROM t1;
+--error 1062
+INSERT INTO t2 SELECT a FROM t1;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # BUG#46384 - mysqld segfault when trying to create table with same 
+--echo #             name as existing view
+--echo #
+
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+
+INSERT INTO t1 VALUES (1),(2),(3);
+INSERT INTO t2 VALUES (1),(2),(3);
+
+CREATE VIEW v1 AS SELECT t1.a FROM t1, t2;
+--error ER_TABLE_EXISTS_ERROR
+CREATE TABLE v1 AS SELECT * FROM t1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+--echo End of 5.0 tests
 
 #
 # Test of behaviour with CREATE ... SELECT
@@ -697,7 +1261,7 @@ CREATE TEMPORARY TABLE t2 (primary key (a)) select * from t1;
 drop table if exists t2;
 CREATE TABLE t2 (a int, b int, primary key (a));
 --error ER_DUP_ENTRY
-CREATE TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
+INSERT INTO t2 select * from t1;
 SELECT * from t2;
 TRUNCATE table t2;
 --error ER_DUP_ENTRY
@@ -707,14 +1271,11 @@ drop table t2;
 
 CREATE TEMPORARY TABLE t2 (a int, b int, primary key (a));
 --error ER_DUP_ENTRY
-CREATE TEMPORARY TABLE IF NOT EXISTS t2 (primary key (a)) select * from t1;
-SELECT * from t2;
-TRUNCATE table t2;
---error ER_DUP_ENTRY
-INSERT INTO t2 select * from t1;
+INSERT INTO t2 SELECT * FROM t1;
 SELECT * from t2;
 drop table t1,t2;
 
+
 #
 # Test incorrect database names
 #
@@ -723,14 +1284,17 @@ drop table t1,t2;
 CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
 --error 1102
 DROP DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
---error 1064
-RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
---error 1064
-RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-create database mysqltest;
---error 1064
-RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
-drop database mysqltest;
+
+# TODO: enable these tests when RENAME DATABASE is implemented.
+# --error 1049
+# RENAME DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa TO a;
+# --error 1102
+# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+# create database mysqltest;
+# --error 1102
+# RENAME DATABASE mysqltest TO aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
+# drop database mysqltest;
+
 --error 1102
 USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
 --error 1102
diff --git a/mysql-test/suite/pbxt/t/date_formats.test b/mysql-test/suite/pbxt/t/date_formats.test
index 6bfd6843d65..f09ce295659 100644
--- a/mysql-test/suite/pbxt/t/date_formats.test
+++ b/mysql-test/suite/pbxt/t/date_formats.test
@@ -6,86 +6,88 @@
 drop table if exists t1;
 --enable_warnings
 
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW GLOBAL VARIABLES LIKE "%_format%";
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW SESSION VARIABLES LIKE "%_format%";
+SELECT variable_name, variable_value
+FROM information_schema.global_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
 
-#
-# Test setting a lot of different formats to see which formats are accepted and
-# which aren't
-#
-
-SET time_format='%H%i%s';
-SET time_format='%H:%i:%s.%f';
-SET time_format='%h-%i-%s.%f%p';
-SET time_format='%h:%i:%s.%f %p';
-SET time_format='%h:%i:%s%p';
-
-SET date_format='%Y%m%d';
-SET date_format='%Y.%m.%d';
-SET date_format='%d.%m.%Y';
-SET date_format='%m-%d-%Y';
-
-set datetime_format= '%Y%m%d%H%i%s';
-set datetime_format= '%Y-%m-%d %H:%i:%s';
-set datetime_format= '%m-%d-%y %H:%i:%s.%f';
-set datetime_format= '%d-%m-%Y %h:%i:%s%p';
-set datetime_format= '%H:%i:%s %Y-%m-%d';
-set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
-set datetime_format= '%h:%i:%s %p %Y-%m-%d';
-set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
-
---replace_result ROW <format> STATEMENT <format> MIXED <format>
-SHOW SESSION VARIABLES LIKE "%format";
-
---error 1231
-SET time_format='%h:%i:%s';
---error 1231
-SET time_format='%H %i:%s';
---error 1231
-SET time_format='%H::%i:%s';
---error 1231
-SET time_format='%H:%i:%s%f';
---error 1231
-SET time_format='%H:%i.%f:%s';
---error 1231
-SET time_format='%H:%i:%s%p';
---error 1231
-SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
---error 1231
-SET time_format='%H%i%s.%f';
---error 1231
-SET time_format='%H:%i-%s.%f';
---error 1231
-SET date_format='%d.%m.%d';
---error 1231
-SET datetime_format='%h.%m.%y %d.%i.%s';
---error 1231
-set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
-
-#
-# Test GLOBAL values
-
-set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
-SET SESSION datetime_format=default;
-select @@global.datetime_format, @@session.datetime_format;
-SET GLOBAL datetime_format=default;
-SET SESSION datetime_format=default;
-select @@global.datetime_format, @@session.datetime_format;
-
-SET GLOBAL date_format=default;
-SET GLOBAL time_format=default;
-SET GLOBAL datetime_format=default;
-SET time_format=default;
-SET date_format=default;
-SET datetime_format=default;
+SELECT variable_name, variable_value
+FROM information_schema.session_variables
+WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+ORDER BY variable_name;
 
 #
 # The following tests will work only when we at some point will enable
 # dynamic changing of formats
 #
 
+# SET time_format='%H%i%s';
+# SET time_format='%H:%i:%s.%f';
+# SET time_format='%h-%i-%s.%f%p';
+# SET time_format='%h:%i:%s.%f %p';
+# SET time_format='%h:%i:%s%p';
+# 
+# SET date_format='%Y%m%d';
+# SET date_format='%Y.%m.%d';
+# SET date_format='%d.%m.%Y';
+# SET date_format='%m-%d-%Y';
+# 
+# set datetime_format= '%Y%m%d%H%i%s';
+# set datetime_format= '%Y-%m-%d %H:%i:%s';
+# set datetime_format= '%m-%d-%y %H:%i:%s.%f';
+# set datetime_format= '%d-%m-%Y %h:%i:%s%p';
+# set datetime_format= '%H:%i:%s %Y-%m-%d';
+# set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
+# set datetime_format= '%h:%i:%s %p %Y-%m-%d';
+# set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
+# 
+# SELECT variable_name, variable_value
+# FROM information_schema.session_variables
+# WHERE variable_name IN ('date_format', 'datetime_format', 'time_format')
+# ORDER BY variable_name;
+# 
+# --error 1231
+# SET time_format='%h:%i:%s';
+# --error 1231
+# SET time_format='%H %i:%s';
+# --error 1231
+# SET time_format='%H::%i:%s';
+# --error 1231
+# SET time_format='%H:%i:%s%f';
+# --error 1231
+# SET time_format='%H:%i.%f:%s';
+# --error 1231
+# SET time_format='%H:%i:%s%p';
+# --error 1231
+# SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
+# --error 1231
+# SET time_format='%H%i%s.%f';
+# --error 1231
+# SET time_format='%H:%i-%s.%f';
+# --error 1231
+# SET date_format='%d.%m.%d';
+# --error 1231
+# SET datetime_format='%h.%m.%y %d.%i.%s';
+# --error 1231
+# set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
+# 
+# #
+# # Test GLOBAL values
+# 
+# set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
+# SET SESSION datetime_format=default;
+# select @@global.datetime_format, @@session.datetime_format;
+# SET GLOBAL datetime_format=default;
+# SET SESSION datetime_format=default;
+# select @@global.datetime_format, @@session.datetime_format;
+# 
+# SET GLOBAL date_format=default;
+# SET GLOBAL time_format=default;
+# SET GLOBAL datetime_format=default;
+# SET time_format=default;
+# SET date_format=default;
+# SET datetime_format=default;
+
 # SET date_format='%d.%m.%Y';
 # select CAST('01.01.2001' as DATE) as a;
 # SET datetime_format='%d.%m.%Y %H.%i.%s';
@@ -121,7 +123,7 @@ SET datetime_format=default;
 # Test of str_to_date
 #
 
-# PS doesn't support fraction of a seconds
+# PS doesn't support fractions of a second
 --disable_ps_protocol
 select str_to_date(concat('15-01-2001',' 2:59:58.999'),
 	           concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
@@ -132,6 +134,8 @@ create table t1 (date char(30), format char(30) not null);
 insert into t1 values
 ('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
 ('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S.%#'),
+('0003-01-02 8:11:2.123456', '%Y-%m-%d %H:%i:%S.%#'),
+('03-01-02 8:11:2.123456',   '%Y-%m-%d %H:%i:%S.%#'),
 ('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
 ('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
 ('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
diff --git a/mysql-test/suite/pbxt/t/derived.test b/mysql-test/suite/pbxt/t/derived.test
index a9127b49741..3a4f86563a1 100644
--- a/mysql-test/suite/pbxt/t/derived.test
+++ b/mysql-test/suite/pbxt/t/derived.test
@@ -45,7 +45,7 @@ select * from (select * from t1 where t1.a=(select t2.a from t2 where t2.a=t1.a)
 explain select * from (select t1.*, t2.a as t2a from t1,t2 where t1.a=t2.a) t1;
 drop table t1, t2;
 create table t1(a int not null, t char(8), index(a));
-disable_query_log;
+--disable_query_log
 begin;
 let $1 = 10000;
 while ($1)
@@ -54,7 +54,7 @@ while ($1)
   dec $1;
  }
 commit;
-enable_query_log;
+--enable_query_log
 SELECT * FROM (SELECT * FROM t1) as b ORDER BY a  ASC LIMIT 0,20;
 explain select count(*) from t1 as tt1, (select * from t1) as tt2;
 drop table t1;
@@ -101,7 +101,7 @@ SELECT a.x FROM (SELECT 1 AS x) AS a HAVING a.x = 1;
 #
 # Test for select if database is not selected.
 #
-# Connect without a database
+# Connect without a database as user mysqltest_1
 create user mysqltest_1;
 create table t1 select 1 as a;
 analyze table t1; # PBXT: Required to get a consitent result
@@ -161,7 +161,7 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) >
 delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
 select * from t1;
 --replace_result P2 p2
---error ER_UNKNOWN_TABLE 
+--error ER_NON_UPDATABLE_TABLE
 delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
 -- error 1054
 delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
@@ -214,7 +214,8 @@ drop table t2;
 # select list counter
 #
 CREATE TABLE `t1` ( `itemid` int(11) NOT NULL default '0', `grpid` varchar(15) NOT NULL default '', `vendor` int(11) NOT NULL default '0', `date_` date NOT NULL default '0000-00-00', `price` decimal(12,2) NOT NULL default '0.00', PRIMARY KEY  (`itemid`,`grpid`,`vendor`,`date_`), KEY `itemid` (`itemid`,`vendor`), KEY `itemid_2` (`itemid`,`date_`));
-insert into t1 values (128, 'rozn', 2, now(), 10),(128, 'rozn', 1, now(), 10);
+insert into t1 values (128, 'rozn', 2, curdate(), 10),
+  (128, 'rozn', 1, curdate(), 10);
 SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MAX(concat(date_,";",price)), 12) price FROM t1 WHERE itemid=128 AND  grpid='rozn' GROUP BY itemid, grpid, vendor) lastprices;
 DROP TABLE t1;
 
@@ -275,7 +276,9 @@ select t2.* from ((select * from t1) as A inner join t2 on A.ID = t2.FID);
 select t2.* from (select * from t1) as A inner join t2 on A.ID = t2.FID;
 drop table t1, t2;
 
+connection con1;
 disconnect con1;
+--source include/wait_until_disconnected.inc
 connection default;
 drop user mysqltest_1;
 
diff --git a/mysql-test/suite/pbxt/t/drop.test b/mysql-test/suite/pbxt/t/drop.test
index 0e2f62f9812..e7101f616a8 100644
--- a/mysql-test/suite/pbxt/t/drop.test
+++ b/mysql-test/suite/pbxt/t/drop.test
@@ -100,8 +100,8 @@ drop database if exists mysqltest;
 drop table if exists t1;
 --enable_warnings
 create table t1 (i int);
-lock tables t1 read;
 create database mysqltest;
+lock tables t1 read;
 connect (addconroot1, localhost, root,,);
 --send drop table t1
 connect (addconroot2, localhost, root,,);
@@ -117,8 +117,11 @@ connection addconroot1;
 --reap
 connection addconroot2;
 --reap
-disconnect addconroot1;
 disconnect addconroot2;
+--source include/wait_until_disconnected.inc
+connection addconroot1;
+disconnect addconroot1;
+--source include/wait_until_disconnected.inc
 connection default;
 
 --disable_query_log
diff --git a/mysql-test/suite/pbxt/t/endspace.test b/mysql-test/suite/pbxt/t/endspace.test
index f2dcc1225a4..f2502640e71 100644
--- a/mysql-test/suite/pbxt/t/endspace.test
+++ b/mysql-test/suite/pbxt/t/endspace.test
@@ -90,7 +90,9 @@ alter table t1 modify text1 text not null, pack_keys=1;
 select * from t1 where text1 like 'teststring_%';
 
 # The following gives wrong result in InnoDB
+--sorted_result
 select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
+--sorted_result
 select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
 select concat('|', text1, '|') from t1 order by text1;
 drop table t1;
diff --git a/mysql-test/suite/pbxt/t/flush.test b/mysql-test/suite/pbxt/t/flush.test
index f9329f08adf..c2656909989 100644
--- a/mysql-test/suite/pbxt/t/flush.test
+++ b/mysql-test/suite/pbxt/t/flush.test
@@ -68,10 +68,13 @@ drop table t1;
 create table t1 (c1 int);
 lock table t1 write;
 # Cannot get the global read lock with write locked tables.
---error 1192
+--error ER_LOCK_OR_ACTIVE_TRANSACTION 
 flush tables with read lock;
 lock table t1 read;
-# Can get the global read lock with read locked tables.
+# Cannot get the global read lock with read locked tables.
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
+flush tables with read lock;
+unlock tables;
 flush tables with read lock;
 --error 1223
 lock table t1 write;
@@ -84,12 +87,12 @@ create table t2 (c1 int);
 create table t3 (c1 int);
 lock table t1 read, t2 read, t3 write;
 # Cannot get the global read lock with write locked tables.
---error 1192
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
 flush tables with read lock;
 lock table t1 read, t2 read, t3 read;
-# Can get the global read lock with read locked tables.
+# Cannot get the global read lock with read locked tables.
+--error ER_LOCK_OR_ACTIVE_TRANSACTION
 flush tables with read lock;
-# Release all table locks and the global read lock.
 unlock tables;
 drop table t1, t2, t3;
 
diff --git a/mysql-test/suite/pbxt/t/flush_table.test b/mysql-test/suite/pbxt/t/flush_table.test
index fa7ef83e076..dd11da38a2d 100644
--- a/mysql-test/suite/pbxt/t/flush_table.test
+++ b/mysql-test/suite/pbxt/t/flush_table.test
@@ -15,30 +15,21 @@ insert into t1 values(0);
 # Test for with read lock + flush
 
 lock table t1 read;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 flush table t1;
-check table t1;
 unlock tables;
 
-# Test for with 2 read lock in different thread + flush
+# Test for with write lock + flush
 
-lock table t1 read;
-connect (locker,localhost,root,,test);
-connection locker;
-lock table t1 read;
-connection default;
-send flush table t1;
-connection locker;
---sleep 2
-select * from t1;
-unlock tables;
-connection default;
-reap;
-select * from t1;
+lock table t1 write;
+flush table t1;
+check table t1;
 unlock tables;
 
 # Test for with a write lock and a waiting read lock + flush
 
 lock table t1 write;
+connect (locker,localhost,root,,test);
 connection locker;
 send lock table t1 read;
 connection default;
@@ -51,9 +42,9 @@ reap;
 unlock tables;
 connection default;
 
-# Test for with a read lock and a waiting write lock + flush
+# Test for with a write lock and a waiting write lock + flush
 
-lock table t1 read;
+lock table t1 write;
 connection locker;
 send lock table t1 write;
 connection default;
diff --git a/mysql-test/suite/pbxt/t/func_str.test b/mysql-test/suite/pbxt/t/func_str.test
index 8f516e6c4d9..aa8e4163ca2 100644
--- a/mysql-test/suite/pbxt/t/func_str.test
+++ b/mysql-test/suite/pbxt/t/func_str.test
@@ -442,7 +442,7 @@ where collation(t2.a) = _utf8'binary' order by t1.a,t2.a;
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
 where charset(t2.a) = _utf8'binary' order by t1.a,t2.a;
 select t1.*,t2.* from t1 left join t2 on (t1.b=t2.b)
-where coercibility(t2.a) = 2 order by t1.a,t2.a;
+where coercibility(t2.a) = 5 order by t1.a,t2.a;
 DROP TABLE t1, t2;
 
 #
diff --git a/mysql-test/suite/pbxt/t/group_by.test b/mysql-test/suite/pbxt/t/group_by.test
index c1909668b55..5e86b896731 100644
--- a/mysql-test/suite/pbxt/t/group_by.test
+++ b/mysql-test/suite/pbxt/t/group_by.test
@@ -120,8 +120,9 @@ SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2
 SELECT cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY NULL;
 SELECT HIGH_PRIORITY cid, CONCAT(firstname, ' ', surname), COUNT(call_id) FROM t1 LEFT JOIN t2 ON cid=contact_id WHERE firstname like '%foo%' GROUP BY cid ORDER BY surname, firstname;
 
-drop table t1,t2;
+drop table t2;
 unlock tables;
+drop table t1;
 
 #
 # Test of group by bug in bugzilla
@@ -705,15 +706,83 @@ DROP TABLE t1;
 
 #
 # Bug #21174: Index degrades sort performance and 
-#             optimizer does not honor IGNORE INDEX
-#
-CREATE TABLE t1 (a INT, b INT, KEY(a));
-INSERT INTO t1 VALUES (1, 1), (2, 2), (3,3), (4,4);
+#             optimizer does not honor IGNORE INDEX.
+#             a.k.a WL3527.
+#
+CREATE TABLE t1 (a INT, b INT,
+                 PRIMARY KEY (a),
+                 KEY i2(a,b));
+INSERT INTO t1 VALUES (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8);
+INSERT INTO t1 SELECT a + 8,b FROM t1;
+INSERT INTO t1 SELECT a + 16,b FROM t1;
+INSERT INTO t1 SELECT a + 32,b FROM t1;
+INSERT INTO t1 SELECT a + 64,b FROM t1;
+INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16;
+ANALYZE TABLE t1;
+EXPLAIN SELECT a FROM t1 WHERE a < 2;
+EXPLAIN SELECT a FROM t1 WHERE a < 2 ORDER BY a;
+EXPLAIN SELECT a FROM t1 WHERE a < 2 GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY,i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR JOIN (PRIMARY,i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (PRIMARY,i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY,i2) ORDER BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (PRIMARY)
+  IGNORE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (PRIMARY) IGNORE INDEX FOR ORDER BY (i2);
+EXPLAIN SELECT a FROM t1 FORCE INDEX (i2);
+EXPLAIN SELECT a FROM t1 USE INDEX ();
+EXPLAIN SELECT a FROM t1 USE INDEX () USE INDEX (i2);
+--error ER_WRONG_USAGE
+EXPLAIN SELECT a FROM t1 
+  FORCE INDEX (PRIMARY) 
+  IGNORE INDEX FOR GROUP BY (i2)
+  IGNORE INDEX FOR ORDER BY (i2)
+  USE INDEX (i2);
+EXPLAIN SELECT a FROM t1 USE INDEX (i2) USE INDEX ();
+--error ER_PARSE_ERROR
+EXPLAIN SELECT a FROM t1 FORCE INDEX ();
+--error ER_PARSE_ERROR
+EXPLAIN SELECT a FROM t1 IGNORE INDEX ();
+# disable the columns irrelevant to this test here. On some systems 
+# without support for large files the rowid is shorter and its size affects 
+# the cost calculations. This causes the optimizer to choose loose index
+# scan over normal index access.
+--replace_column 4 # 7 # 9 # 10 #
+EXPLAIN SELECT a FROM t1 USE INDEX FOR JOIN (i2) 
+  USE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 FORCE INDEX FOR JOIN (i2) 
+  FORCE INDEX FOR GROUP BY (i2) GROUP BY a;
+EXPLAIN SELECT a FROM t1 USE INDEX () IGNORE INDEX (i2);
+EXPLAIN SELECT a FROM t1 IGNORE INDEX (i2) USE INDEX ();
+
+EXPLAIN SELECT a FROM t1 
+  USE INDEX FOR GROUP BY (i2) 
+  USE INDEX FOR ORDER BY (i2)
+  USE INDEX FOR JOIN (i2);
+
+EXPLAIN SELECT a FROM t1 
+  USE INDEX FOR JOIN (i2) 
+  USE INDEX FOR JOIN (i2) 
+  USE INDEX FOR JOIN (i2,i2);
+
+EXPLAIN SELECT 1 FROM t1 WHERE a IN
+  (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+
+CREATE TABLE t2 (a INT, b INT, KEY(a));
+INSERT INTO t2 VALUES (1, 1), (2, 2), (3,3), (4,4);
+EXPLAIN SELECT a, SUM(b) FROM t2 GROUP BY a LIMIT 2; 
+EXPLAIN SELECT a, SUM(b) FROM t2 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+
+EXPLAIN SELECT 1 FROM t2 WHERE a IN
+  (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2));
+
+SHOW VARIABLES LIKE 'old';  
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@old = off;  
 
-EXPLAIN SELECT a, SUM(b) FROM t1 GROUP BY a LIMIT 2; 
-EXPLAIN SELECT a, SUM(b) FROM t1 IGNORE INDEX (a) GROUP BY a LIMIT 2;
+DROP TABLE t1, t2;
 
-DROP TABLE t1;
 
 --disable_query_log
 drop database pbxt;
diff --git a/mysql-test/suite/pbxt/t/key_cache.test b/mysql-test/suite/pbxt/t/key_cache.test
deleted file mode 100644
index 10dbdda6068..00000000000
--- a/mysql-test/suite/pbxt/t/key_cache.test
+++ /dev/null
@@ -1,229 +0,0 @@
-#
-# Test of multiple key caches
-#
---disable_warnings
-drop table if exists t1, t2, t3;
---enable_warnings
-
-SET @save_key_buffer=@@key_buffer_size;
-
-SELECT @@key_buffer_size, @@small.key_buffer_size;
-
-# Change default key cache size
-SET @@global.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-SET @@global.default.key_buffer_size=16*1024*1024;
-
-SET @@global.small.key_buffer_size=1*1024*1024;
-SET @@global.medium.key_buffer_size=4*1024*1024;
-# Drop buffer
-SET @@global.medium.key_buffer_size=0;
-# Test double drop
-SET @@global.medium.key_buffer_size=0;
-
-# Print key buffer with different syntaxes
-SHOW VARIABLES like "key_buffer_size";
-SELECT @@key_buffer_size;
-SELECT @@global.key_buffer_size;
-SELECT @@global.default.key_buffer_size;
-SELECT @@global.default.`key_buffer_size`;
-SELECT @@global.`default`.`key_buffer_size`;
-SELECT @@`default`.key_buffer_size;
-
-SELECT @@small.key_buffer_size;
-SELECT @@medium.key_buffer_size;
-
-SET @@global.key_buffer_size=@save_key_buffer;
-
-#
-# Errors
-#
-
---error 1064
-SELECT @@default.key_buffer_size;
---error 1272
-SELECT @@skr.storage_engine="test";
-
-select @@keycache1.key_cache_block_size;
-select @@keycache1.key_buffer_size;
-set global keycache1.key_cache_block_size=2048;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-set global keycache1.key_buffer_size=1*1024*1024;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-set global keycache2.key_buffer_size=4*1024*1024;
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache1.key_buffer_size=0;
-select @@keycache1.key_buffer_size;
-select @@keycache1.key_cache_block_size;
-select @@key_buffer_size;
-select @@key_cache_block_size;
-
-set global keycache1.key_buffer_size=1024*1024;
-
-create table t1 (p int primary key, a char(10)) delay_key_write=1;
-create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a));
-
-# PBXT: this is irrelevant for PBXT and gives different results on different systems
-#show status like 'key_blocks_used';
-
-# Following results differs on 64 and 32 bit systems because of different
-# pointer sizes, which takes up different amount of space in key cache
-
-# PBXT: this is irrelevant for PBXT and gives different results on different systems
-#--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
-#show status like 'key_blocks_unused';
-
-insert into t1 values (1, 'qqqq'), (11, 'yyyy');
-insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'),
-                      (3, 1, 'yyyy'), (4, 3, 'zzzz');
-select * from t1;
-select * from t2;
-
-update t1 set p=2 where p=1;
-update t2 set i=2 where i=1;
-
-# PBXT: this is irrelevant for PBXT and gives different results on different systems
-#show status like 'key_blocks_used';
-#--replace_result 1808 KEY_BLOCKS_UNUSED 1789 KEY_BLOCKS_UNUSED 1670 KEY_BLOCKS_UNUSED 1814 KEY_BLOCKS_UNUSED 1820 KEY_BLOCKS_UNUSED
-#show status like 'key_blocks_unused';
-
-cache index t1 key (`primary`) in keycache1;
-
-explain select p from t1;
-select p from t1;
-explain select i from t2;
-select i from t2;
-explain select count(*) from t1, t2 where t1.p = t2.i;
-select count(*) from t1, t2 where t1.p = t2.i;
-
-cache index t2 in keycache1;
-update t2 set p=p+1000, i=2 where a='qqqq';
-cache index t2 in keycache2;
-insert into t2 values (2000, 3, 'yyyy');
-cache index t2 in keycache1;
-update t2 set p=3000 where a='zzzz';
-select * from t2 order by p; # PBXT required ORDER for consistant result
-explain select p from t2;
-select p from t2;
-explain select i from t2;
-select i from t2;
-explain select a from t2;
-select a from t2;
-
-# Test some error conditions
---error 1284
-cache index t1 in unknown_key_cache;
-cache index t1 key (unknown_key) in keycache1;
-
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache2.key_buffer_size=0;
-select @@keycache2.key_buffer_size;
-select @@keycache2.key_cache_block_size;
-set global keycache2.key_buffer_size=1024*1024;
-select @@keycache2.key_buffer_size;
-
-update t2 set p=4000 where a='zzzz';
-update t1 set p=p+1;
-
-set global keycache1.key_buffer_size=0;
-select * from t2 order by p; # PBXT required ORDER for consistant result
-select p from t2 order by p; # PBXT required ORDER for consistant result
-explain select i from t2;
-select i from t2;
-explain select a from t2;
-select a from t2;
-
-select * from t1;
-select p from t1;
-
-# Use the 'small' key cache
-create table t3 (like t1);
-cache index t3 in small;
-insert into t3 select * from t1;
-cache index t3 in keycache2;
-cache index t1,t2 in default;
-drop table t1,t2,t3;
-
-# PBXT: this is irrelevant for PBXT and gives different results on different systems
-#show status like 'key_blocks_used';
-#--replace_result 1812 KEY_BLOCKS_UNUSED 1793 KEY_BLOCKS_UNUSED 1674 KEY_BLOCKS_UNUSED 1818 KEY_BLOCKS_UNUSED 1824 KEY_BLOCKS_UNUSED
-#show status like 'key_blocks_unused';
-
-
-# Cleanup
-# We don't reset keycache2 as we want to ensure that mysqld will reset it
-set global keycache2.key_buffer_size=0;
-
-# Test to set up a too small size for a key cache (bug #2064)
-set global keycache3.key_buffer_size=100;
-set global keycache3.key_buffer_size=0;
-
-# Test case for bug 6447
-
-create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam; # PBXT: Only MyISAM can do FULLTEXT
-insert t1 values ('aaabbb');
-
-check table t1;
-set @my_key_cache_block_size= @@global.key_cache_block_size;
-set GLOBAL key_cache_block_size=2048;
-check table t1;
-drop table t1;
-# Restore the changed variable value
-set global key_cache_block_size= @my_key_cache_block_size;
-
-#
-# Bug #19079: corrupted index when key_cache_block_size is not multiple of
-#             myisam_block_size
-
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY);
-SET @my_key_cache_block_size= @@global.key_cache_block_size;
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1);
-SELECT @@key_cache_block_size;
-CHECK TABLE t1;
-DROP TABLE t1;
-
-CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int);
-SET GLOBAL key_cache_block_size=1536;
-INSERT INTO t1 VALUES (1,0);
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-INSERT INTO t2(b) SELECT b FROM t1;
-INSERT INTO t1(b) SELECT b FROM t2;
-SELECT COUNT(*) FROM t1;
-SELECT @@key_cache_block_size;
-CHECK TABLE t1;
-DROP TABLE t1,t2;
-# Restore changed variables
-set global key_cache_block_size= @my_key_cache_block_size;
-
-#
-# Bug#10473 - Can't set 'key_buffer_size' system variable to ZERO
-# (One cannot drop the default key cache.)
-#
-set @@global.key_buffer_size=0;
-select @@global.key_buffer_size;
-
---disable_query_log
-drop database pbxt;
---enable_query_log
-# End of 4.1 tests
diff --git a/mysql-test/suite/pbxt/t/lock.test b/mysql-test/suite/pbxt/t/lock.test
index 266fc7397c2..a42b4cbfd07 100644
--- a/mysql-test/suite/pbxt/t/lock.test
+++ b/mysql-test/suite/pbxt/t/lock.test
@@ -3,7 +3,7 @@
 #
 
 --disable_warnings
-drop table if exists t1,t2;
+drop table if exists t1,t2,t3;
 --enable_warnings
 CREATE TABLE t1 (  `id` int(11) NOT NULL default '0', `id2` int(11) NOT NULL default '0', `id3` int(11) NOT NULL default '0', `dummy1` char(30) default NULL, PRIMARY KEY  (`id`,`id2`), KEY `index_id3` (`id3`)) ENGINE=MyISAM;
 insert into t1 (id,id2) values (1,1),(1,2),(1,3);
@@ -58,6 +58,9 @@ insert into t1 select index1,nr from t1;
 unlock tables;
 lock tables t1 write, t1 as t1_alias read;
 insert into t1 select index1,nr from t1 as t1_alias;
+--error ER_TABLE_NOT_LOCKED
+drop table t1,t2;
+unlock tables;
 drop table t1,t2;
 
 #
@@ -90,9 +93,13 @@ delete t1 from t1,t2 where t1.a=t2.a;
 delete from t2 using t1,t2 where t1.a=t2.a;
 --error 1099
 delete t2 from t1,t2 where t1.a=t2.a;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
 drop table t1,t2;
+unlock tables;
+drop table t2,t1;
+
+--echo End of 4.1 tests.
 
-# End of 4.1 tests
 
 #
 # Bug#18884 "lock table + global read lock = crash"
diff --git a/mysql-test/suite/pbxt/t/lock_multi.test b/mysql-test/suite/pbxt/t/lock_multi.test
index 1104620b6b5..b15e6c9dea3 100644
--- a/mysql-test/suite/pbxt/t/lock_multi.test
+++ b/mysql-test/suite/pbxt/t/lock_multi.test
@@ -30,6 +30,7 @@ update t1,t2 set c=a where b=d;
 connection reader;
 select c from t2;
 connection locker;
+unlock tables;
 drop table t1;
 drop table t2;
 
@@ -48,9 +49,11 @@ insert t1 select * from t2;
 connection locker;
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "insert t1 select * from t2";
+  where state = "Waiting for table metadata lock" and
+        info = "insert t1 select * from t2";
 --source include/wait_condition.inc
 drop table t2;
+unlock tables;
 connection reader;
 --error ER_NO_SUCH_TABLE
 reap;
@@ -72,9 +75,11 @@ connection locker;
 # Sleep a bit till the insert of connection reader is in work and hangs
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "insert t1 select * from t2";
+  where state = "Waiting for table metadata lock" and
+        info = "insert t1 select * from t2";
 --source include/wait_condition.inc
 drop table t2;
+unlock tables;
 connection reader;
 --error ER_NO_SUCH_TABLE
 reap;
@@ -116,8 +121,8 @@ SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
 connection locker;
 # Sleep a bit till the select of connection reader is in work and hangs
 let $wait_condition=
-  select count(*) = 1 from information_schema.processlist
-  where state = "Waiting for table" and info =
+  SELECT COUNT(*) = 1 FROM information_schema.processlist
+  WHERE state = "Waiting for table metadata lock" AND info =
   "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
 --source include/wait_condition.inc
 # Make test case independent from earlier grants.
@@ -149,9 +154,11 @@ connection writer;
 # Sleep a bit till the flush of connection locker is in work and hangs
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
+  where state = "Waiting for global read lock" and
+        info = "FLUSH TABLES WITH READ LOCK";
 --source include/wait_condition.inc
 # This must not block.
+--error ER_TABLE_NOT_LOCKED
 CREATE TABLE t2 (c1 int);
 UNLOCK TABLES;
 #
@@ -161,7 +168,7 @@ reap;
 UNLOCK TABLES;
 #
 connection default;
-DROP TABLE t1, t2;
+DROP TABLE t1;
 #
 # Test if CREATE TABLE SELECT with LOCK TABLE deadlocks.
 #
@@ -179,7 +186,8 @@ connection writer;
 # Sleep a bit till the flush of connection locker is in work and hangs
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
+  where state = "Waiting for global read lock" and
+        info = "FLUSH TABLES WITH READ LOCK";
 --source include/wait_condition.inc
 --error ER_TABLE_NOT_LOCKED
 CREATE TABLE t2 AS SELECT * FROM t1;
@@ -214,10 +222,11 @@ DROP DATABASE mysqltest_1;
 # With bug in place: try to acquire LOCK_mysql_create_table...
 # When fixed: Reject dropping db because of the read lock.
 connection con1;
-# Wait a bit so that the session con2 is in state "Waiting for release of readlock"
+# Wait a bit so that the session con2 is in state
+# "Waiting for global read lock"
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Waiting for release of readlock"
+  where state = "Waiting for global read lock"
   and info = "DROP DATABASE mysqltest_1";
 --source include/wait_condition.inc
 --error ER_CANT_UPDATE_WITH_READLOCK
@@ -251,7 +260,8 @@ connection reader;
 # Wait till connection writer is blocked
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "alter table t1 auto_increment=0";
+  where state = "Waiting for table metadata lock" and
+        info = "alter table t1 auto_increment=0";
 --source include/wait_condition.inc
 send
 alter table t1 auto_increment=0;
@@ -259,7 +269,8 @@ connection locker;
 # Wait till connection reader is blocked
 let $wait_condition=
   select count(*) = 2 from information_schema.processlist
-  where state = "Locked" and info = "alter table t1 auto_increment=0";
+  where state = "Waiting for table metadata lock" and
+        info = "alter table t1 auto_increment=0";
 --source include/wait_condition.inc
 unlock tables;
 connection writer;
@@ -290,19 +301,21 @@ connection con2;
 send flush tables with read lock;
 connection con5;
 --echo # con5
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Flushing tables';
---source include/wait_show_condition.inc
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for global read lock" and
+        info = "flush tables with read lock";
+--source include/wait_condition.inc
 --echo # global read lock is taken
 connection con3;
 --echo # con3
 send select * from t2 for update;
 connection con5;
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for global read lock" and
+        info = "select * from t2 for update";
+--source include/wait_condition.inc
 --echo # waiting for release of read lock
 connection con4;
 --echo # con4
@@ -348,10 +361,11 @@ connection con1;
 send update t2 set a = 1;
 connection default;
 --echo # default
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for global read lock" and
+        info = "update t2 set a = 1";
+--source include/wait_condition.inc
 --echo # statement is waiting for release of read lock
 connection con2;
 --echo # con2
@@ -375,10 +389,11 @@ connection con1;
 send lock tables t2 write;
 connection default;
 --echo # default
-let $show_statement= SHOW PROCESSLIST;
-let $field= State;
-let $condition= = 'Waiting for release of readlock';
---source include/wait_show_condition.inc
+let $wait_condition=
+  select count(*) = 1 from information_schema.processlist
+  where state = "Waiting for global read lock" and
+        info = "lock tables t2 write";
+--source include/wait_condition.inc
 --echo # statement is waiting for release of read lock
 connection con2;
 --echo # con2
@@ -401,46 +416,12 @@ drop table t1,t2;
 --echo End of 5.0 tests
 
 
-#
-# Bug#21281 Pending write lock is incorrectly removed when its
-#           statement being KILLed
-#
-create table t1 (i int);
-connection locker;
-lock table t1 read;
-connection writer;
-send
-update t1 set i= 10;
-connection reader;
-let $wait_condition=
-  select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "update t1 set i= 10";
---source include/wait_condition.inc
-send
-select * from t1;
-connection default;
-let $wait_condition=
-  select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "select * from t1";
---source include/wait_condition.inc
-let $ID= `select id from information_schema.processlist where state = "Locked" and info = "update t1 set i= 10"`;
---replace_result $ID ID
-eval kill query $ID;
-connection reader;
---reap
-connection writer;
---error ER_QUERY_INTERRUPTED
---reap
-connection locker;
-unlock tables;
-connection default;
-drop table t1;
-
 # Disconnect sessions used in many subtests above
 disconnect locker;
 disconnect reader;
 disconnect writer;
 
+
 #
 # Bug#32395 Alter table under a impending global read lock causes a server crash
 #
@@ -464,7 +445,8 @@ connection default;
 --echo connection: default
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables";
+  where state = "Waiting for global read lock" and
+        info = "flush tables with read lock";
 --source include/wait_condition.inc
 alter table t1 add column j int;
 connect (insert,localhost,root,,test,,);
@@ -472,14 +454,16 @@ connection insert;
 --echo connection: insert
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables";
+  where state = "Waiting for global read lock" and
+        info = "flush tables with read lock";
 --source include/wait_condition.inc
 --send insert into t1 values (1,2);
 --echo connection: default
 connection default;
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Waiting for release of readlock";
+  where state = "Waiting for global read lock" and
+        info = "insert into t1 values (1,2)";
 --source include/wait_condition.inc
 unlock tables;
 connection flush;
@@ -487,7 +471,8 @@ connection flush;
 --reap
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Waiting for release of readlock";
+  where state = "Waiting for global read lock" and
+        info = "insert into t1 values (1,2)";
 --source include/wait_condition.inc
 select * from t1;
 unlock tables;
@@ -522,18 +507,14 @@ connection default;
 --echo connection: default
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables";
+  where state = "Waiting for global read lock";
 --source include/wait_condition.inc
 flush tables;
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Flushing tables";
+  where state = "Waiting for global read lock";
 --source include/wait_condition.inc
 unlock tables;
-let $wait_condition=
-  select count(*) = 0 from information_schema.processlist
-  where state = "Flushing tables";
---source include/wait_condition.inc
 connection flush;
 --reap
 connection default;
@@ -553,21 +534,23 @@ lock tables t1 read;
 let $tlwa= `show status like 'Table_locks_waited'`;
 connect (waiter,localhost,root,,);
 connection waiter;
---send insert into t1 values(1);
+send insert into t1 values(1);
 connection default;
 let $wait_condition=
   select count(*) = 1 from information_schema.processlist
-  where state = "Locked" and info = "insert into t1 values(1)";
+  where state = "Waiting for table level lock" and
+        info = "insert into t1 values(1)";
 --source include/wait_condition.inc
 let $tlwb= `show status like 'Table_locks_waited'`;
 unlock tables;
+connection waiter;
+--reap
+connection default;
 drop table t1;
 disconnect waiter;
-connection default;
 --disable_query_log
 eval SET @tlwa= SUBSTRING_INDEX('$tlwa', '	', -1);
 eval SET @tlwb= SUBSTRING_INDEX('$tlwb', '	', -1);
-drop database pbxt;
 --enable_query_log
 select @tlwa < @tlwb;
 
@@ -576,3 +559,5 @@ select @tlwa < @tlwb;
 # Wait till all disconnects are completed
 --source include/wait_until_count_sessions.inc
 
+connection default;
+drop database pbxt;
diff --git a/mysql-test/suite/pbxt/t/odbc.test b/mysql-test/suite/pbxt/t/odbc.test
index 51738029577..79be84f5e1c 100644
--- a/mysql-test/suite/pbxt/t/odbc.test
+++ b/mysql-test/suite/pbxt/t/odbc.test
@@ -3,6 +3,8 @@
 drop table if exists t1;
 --enable_warnings
 
+set @@session.sql_auto_is_null=1;
+
 #
 # Test some ODBC compatibility
 #
diff --git a/mysql-test/suite/pbxt/t/partition_error.test b/mysql-test/suite/pbxt/t/partition_error.test
index 5b0c90b9a20..19bb79e460f 100644
--- a/mysql-test/suite/pbxt/t/partition_error.test
+++ b/mysql-test/suite/pbxt/t/partition_error.test
@@ -1,17 +1,17 @@
 #
-# Simple test for the erroneos create statements using the 
+# Simple test for the erroneos statements using the 
 # partition storage engine
 #
 -- source include/have_partition.inc
 
 --disable_warnings
-drop table if exists t1;
+drop table if exists t1, t2;
 --enable_warnings
 
 #
 # Partition by key stand-alone error
 #
---error 1064
+--error ER_PARSE_ERROR
 partition by list (a)
 partitions 3
 (partition x1 values in (1,2,9,4) tablespace ts1,
@@ -48,7 +48,7 @@ partitions 3
 #
 # Partition by key, partition function not allowed
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -63,7 +63,7 @@ partitions 3
 #
 # Partition by key, no partition name
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -90,11 +90,11 @@ partitions 3
  partition x2 tablespace ts2,
  partition x3 tablespace ts3);
 
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 #
 # Partition by hash, invalid field in function
 #
---error 1054
+--error ER_BAD_FIELD_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -124,7 +124,7 @@ partitions 3
 #
 # Partition by key specified 3 partitions but only defined 2 => error
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -135,9 +135,9 @@ partitions 3
 (partition x1, partition x2);
 
 #
-# Partition by key specified 3 partitions but only defined 2 => error
+# Partition by hash, random function
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -148,9 +148,9 @@ partitions 2
 (partition x1, partition x2);
 
 #
-# Partition by key specified 3 partitions but only defined 2 => error
+# Partition by range, random function
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -161,9 +161,9 @@ partitions 2
 (partition x1 values less than (0), partition x2 values less than (2));
 
 #
-# Partition by key specified 3 partitions but only defined 2 => error
+# Partition by list, random function
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -186,7 +186,7 @@ partition by hash (a)
 partitions 2
 (partition x1 values less than (4),
  partition x2 values less than (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Partition by hash, values in error
@@ -201,7 +201,7 @@ partition by hash (a)
 partitions 2
 (partition x1 values in (4),
  partition x2 values in (5));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Partition by hash, values in error
@@ -216,7 +216,7 @@ partition by hash (a)
 partitions 2
 (partition x1 values in (4,6),
  partition x2 values in (5,7));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by key, no partitions defined, single field
@@ -229,7 +229,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by key, no partitions defined, list of fields
@@ -242,7 +242,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by hash, no partitions defined
@@ -255,7 +255,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by key, no partitions defined, single field
@@ -268,7 +268,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by key (b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by key, no partitions defined, list of fields
@@ -281,7 +281,7 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by key (a, b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by hash, no partitions defined
@@ -294,12 +294,12 @@ c int not null,
 primary key (a,b))
 partition by key (a)
 subpartition by hash (a+b);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by hash, no partitions defined, wrong subpartition function
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -321,12 +321,12 @@ partition by key (a)
 subpartition by hash (sin(a+b))
 (partition x1 (subpartition x11, subpartition x12),
  partition x2 (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by hash, no partitions defined, wrong subpartition function
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -350,7 +350,7 @@ partition by range (a)
 subpartition by key (a,d)
 (partition x1 values less than (1) (subpartition x11, subpartition x12),
  partition x2 values less than (2) (subpartition x21, subpartition x22));
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Subpartition by hash, no partitions defined, wrong subpartition function
@@ -367,7 +367,7 @@ subpartition by hash (3+4);
 #
 # Subpartition by hash, no partitions defined, wrong subpartition function
 #
---error 1054
+--error ER_BAD_FIELD_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -388,12 +388,12 @@ b int not null,
 c int not null,
 primary key(a,b))
 partition by range (a);
-select load_file('$MYSQLTEST_VARDIR/master-data/test/t1.par');
+select load_file('$MYSQLD_DATADIR/test/t1.par');
 
 #
 # Partition by range, invalid field in function
 #
---error 1054
+--error ER_BAD_FIELD_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -407,7 +407,7 @@ partitions 2
 #
 # Partition by range, inconsistent partition function and constants
 #
---error 1064
+--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -477,7 +477,7 @@ partitions 2
 #
 # Partition by range, missing parenthesis
 #
---error 1064
+--error ER_PARTITION_WRONG_VALUES_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -491,7 +491,7 @@ partitions 2
 #
 # Partition by range, maxvalue in wrong place
 #
---error 1064
+--error ER_PARTITION_MAXVALUE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -505,7 +505,7 @@ partitions 2
 #
 # Partition by range, maxvalue in several places
 #
---error 1064
+--error ER_PARTITION_MAXVALUE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -547,7 +547,7 @@ partitions 2
 #
 # Subpartition by hash, wrong number of subpartitions
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -567,7 +567,7 @@ subpartitions 3
 #
 # Subpartition by hash, wrong number of subpartitions
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -587,7 +587,7 @@ subpartition by hash (a+b)
 #
 # Subpartition by list => error
 #
---error 1064 
+--error ER_PARSE_ERROR 
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -606,7 +606,7 @@ subpartition by list (a+b)
 #
 # Subpartition by list => error
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -650,7 +650,7 @@ partitions 2
 #
 # Partition by list, invalid field in function
 #
---error 1054
+--error ER_BAD_FIELD_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -720,7 +720,7 @@ partitions 2
 #
 # Partition by list, wrong constant result type (not INT)
 #
---error 1064
+--error ER_VALUES_IS_NOT_INT_TYPE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -734,7 +734,7 @@ partitions 2
 #
 # Partition by list, missing parenthesis
 #
---error 1064
+--error ER_PARSE_ERROR
 CREATE TABLE t1 (
 a int not null,
 b int not null,
@@ -748,7 +748,7 @@ partitions 2
 #
 # Bug #13439: Crash when LESS THAN (non-literal)
 #
---error 1054
+--error ER_BAD_FIELD_ERROR
 CREATE TABLE t1 (a int)
 PARTITION BY RANGE (a)
 (PARTITION p0 VALUES LESS THAN (x1));
@@ -775,13 +775,13 @@ partition by range (ascii(v))
 (partition p0 values less than (10));
 #drop table t1;
 
--- error 1064
+-- error ER_PARSE_ERROR
 create table t1 (a int)
 partition by hash (rand(a));
--- error 1064
+-- error ER_PARSE_ERROR
 create table t1 (a int)
 partition by hash(CURTIME() + a);
--- error 1064
+-- error ER_PARSE_ERROR
 create table t1 (a int)
 partition by hash (NOW()+a);
 -- error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED
diff --git a/mysql-test/suite/pbxt/t/ps_1general.test b/mysql-test/suite/pbxt/t/ps_1general.test
index 8cfb2534b7b..95a65c58ec3 100644
--- a/mysql-test/suite/pbxt/t/ps_1general.test
+++ b/mysql-test/suite/pbxt/t/ps_1general.test
@@ -70,71 +70,71 @@ prepare stmt1 from ' select 1 as my_col ' ;
 # prepare with parameter
 prepare stmt1 from ' select ? as my_col ' ;
 # prepare must fail (incomplete statements/wrong syntax)
---error 1064
+--error ER_PARSE_ERROR
 prepare ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from ;
---error 1064
+--error ER_PARSE_ERROR
 prepare_garbage stmt1 from ' select 1 ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from_garbage ' select 1 ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from ' select_garbage 1 ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare from ' select 1 ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 ' select 1 ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare ? from ' select ? as my_col ' ;
 # statement in variable
 set @arg00='select 1 as my_col';
 prepare stmt1 from @arg00;
 # prepare must fail (query variable is empty)
 set @arg00='';
---error 1065
+--error ER_EMPTY_QUERY
 prepare stmt1 from @arg00;
 set @arg00=NULL;
 # prepare must fail (query variable is NULL)
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from @arg01;
 
 prepare stmt1 from ' select * from t1 where a <= 2 ' ;
 # prepare must fail (column x does not exist)
---error 1054
+--error ER_BAD_FIELD_ERROR
 prepare stmt1 from ' select * from t1 where x <= 2 ' ;
 # cases derived from client_test.c: test_null()
 # prepare must fail (column x does not exist)
---error 1054
+--error ER_BAD_FIELD_ERROR
 prepare stmt1 from ' insert into t1(a,x) values(?,?) ' ;
---error 1054
+--error ER_BAD_FIELD_ERROR
 prepare stmt1 from ' insert into t1(x,a) values(?,?) ' ;
 --disable_warnings
 drop table if exists not_exist ;
 --enable_warnings
 # prepare must fail (table does not exist)
---error 1146
+--error ER_NO_SUCH_TABLE
 prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
 
 # case derived from client_test.c: test_prepare_syntax()
 # prepare must fail (incomplete statement)
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from ' insert into t1 values(? ' ;
---error 1064
+--error ER_PARSE_ERROR
 prepare stmt1 from ' select a, b from t1
                      where a=? and where ' ;
 
 ################ EXECUTE ################
 # execute must fail (statement never_prepared never prepared)
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
 execute never_prepared ;
 # execute must fail (prepare stmt1 just failed,
 #         but there was a successful prepare of stmt1 before)
 prepare stmt1 from ' select * from t1 where a <= 2 ' ;
---error 1146
+--error ER_NO_SUCH_TABLE
 prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
 execute stmt1 ;
 
 # drop the table between prepare and execute
@@ -149,7 +149,7 @@ prepare stmt2 from ' select * from t5 ' ;
 execute stmt2 ;
 drop table t5 ;
 # execute must fail (table was dropped after prepare)
---error 1146
+--error ER_NO_SUCH_TABLE
 execute stmt2 ;
 # cases derived from client_test.c: test_select_prepare()
 # 1. drop + create table (same column names/types/order) 
@@ -230,24 +230,24 @@ set @arg01='two' ;
 prepare stmt1 from ' select * from t1 where a <= ? ' ;
 execute stmt1 using @arg00;
 # execute must fail (too small number of parameters)
---error 1210
+--error ER_WRONG_ARGUMENTS
 execute stmt1 ;
 # execute must fail (too big number of parameters)
---error 1210
+--error ER_WRONG_ARGUMENTS
 execute stmt1 using @arg00, @arg01;
 # execute must fail (parameter is not set)
 execute stmt1 using @not_set;
 
 ################ DEALLOCATE ################
 # deallocate must fail (the statement 'never_prepared' was never prepared)
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
 deallocate prepare never_prepared ;
 # deallocate must fail (prepare stmt1 just failed,
 #         but there was a successful prepare before)
 prepare stmt1 from ' select * from t1 where a <= 2 ' ;
---error 1146
+--error ER_NO_SUCH_TABLE
 prepare stmt1 from ' select * from not_exist where a <= 2 ' ;
---error 1243
+--error ER_UNKNOWN_STMT_HANDLER
 deallocate prepare stmt1;
 create table t5
 (
@@ -320,14 +320,8 @@ prepare stmt4 from ' show status like ''Threads_running'' ';
 execute stmt4;
 prepare stmt4 from ' show variables like ''sql_mode'' ';
 execute stmt4;
-# The output depends on the bdb being enabled and on the history
-# history (actions of the bdb engine).
-# That is the reason why, we switch the output here off.
-#   (The real output will be tested in ps_6bdb.test)
---disable_result_log
-prepare stmt4 from ' show engine pbxt logs '; # PBXT: changed from bdb to pbxt
+prepare stmt4 from ' show engine myisam logs ';
 execute stmt4;
---enable_result_log
 prepare stmt4 from ' show grants for user ';
 prepare stmt4 from ' show create table t2 ';
 prepare stmt4 from ' show master status ';
@@ -351,7 +345,7 @@ drop table if exists t5;
 prepare stmt1 from ' drop table if exists t5 ' ;
 execute stmt1 ;
 prepare stmt1 from ' drop table t5 ' ;
---error 1051
+--error ER_BAD_TABLE_ERROR
 execute stmt1 ;
 
 ## SELECT @@version
@@ -438,7 +432,7 @@ drop database mysqltest ;
 prepare stmt3 from ' describe t2 ';
 execute stmt3;
 drop table t2 ;
---error 1146
+--error ER_NO_SUCH_TABLE
 execute stmt3;
 ## lock/unlock
 --error ER_UNSUPPORTED_PS
@@ -446,18 +440,26 @@ prepare stmt3 from ' lock tables t1 read ' ;
 --error ER_UNSUPPORTED_PS
 prepare stmt3 from ' unlock tables ' ;
 ## Load/Unload table contents
+
+--let $datafile = $MYSQLTEST_VARDIR/tmp/data.txt
+--error 0,1
+--remove_file $datafile
+
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
 --error ER_UNSUPPORTED_PS
-prepare stmt1 from ' load data infile ''data.txt''
-into table t1 fields terminated by ''\t'' ';
-prepare stmt1 from ' select * into outfile ''data.txt'' from t1 ';
-execute stmt1 ;
+eval prepare stmt1 from ' load data infile ''$datafile''
+     into table t1 fields terminated by ''\t'' ';
+--replace_result $MYSQLTEST_VARDIR <MYSQLTEST_VARDIR>
+eval prepare stmt1 from ' select * into outfile ''$datafile'' from t1 ';
+     execute stmt1 ;
 ## 
 prepare stmt1 from ' optimize table t1 ' ;
 prepare stmt1 from ' analyze table t1 ' ;
 prepare stmt1 from ' checksum table t1 ' ;
 prepare stmt1 from ' repair table t1 ' ;
---error ER_UNSUPPORTED_PS
-prepare stmt1 from ' restore table t1 from ''data.txt'' ' ;
+
+--remove_file $datafile
+
 ## handler
 --error ER_UNSUPPORTED_PS
 prepare stmt1 from ' handler t1 open ';
@@ -572,7 +574,7 @@ drop table if exists new_t2;
 --enable_warnings
 prepare stmt3 from ' rename table t2 to new_t2 ';
 execute stmt3;
---error 1050
+--error ER_TABLE_EXISTS_ERROR
 execute stmt3;
 rename table new_t2 to t2;
 drop table t2;
@@ -583,13 +585,13 @@ create table t5 (a int) ;
 # rename must fail, t7 does not exist
 # Clean up the filename here because embedded server reports whole path
 --replace_result $MYSQLTEST_VARDIR . mysqld.1/data/ '' t7.frm t7
---error 1017
+--error ER_FILE_NOT_FOUND
 execute stmt1 ;
 create table t7 (a int) ;
 # rename, t5 -> t6 and t7 -> t8
 execute stmt1 ;
 # rename must fail, t5 and t7 does not exist t6 and t8 already exist
---error 1050
+--error ER_TABLE_EXISTS_ERROR
 execute stmt1 ;
 rename table t6 to t5, t8 to t7 ;
 # rename, t5 -> t6 and t7 -> t8
diff --git a/mysql-test/suite/pbxt/t/ps_grant.test b/mysql-test/suite/pbxt/t/ps_grant.test
index 90ee088e2e7..5258a39245e 100644
--- a/mysql-test/suite/pbxt/t/ps_grant.test
+++ b/mysql-test/suite/pbxt/t/ps_grant.test
@@ -88,8 +88,7 @@ deallocate prepare s_t9;
 #### revoke the access rights to t1
 ## switch back to the first session
 connection default;
-revoke all privileges on mysqltest.t1 from second_user@localhost
-identified by 'looser' ;
+revoke all privileges on mysqltest.t1 from second_user@localhost;
 show grants for second_user@localhost ;
 
 #### check the access as new user
diff --git a/mysql-test/suite/pbxt/t/rename.test b/mysql-test/suite/pbxt/t/rename.test
index 670c68f7965..911579a26f2 100644
--- a/mysql-test/suite/pbxt/t/rename.test
+++ b/mysql-test/suite/pbxt/t/rename.test
@@ -2,6 +2,8 @@
 # Test of rename table
 #
 
+--source include/count_sessions.inc
+
 --disable_warnings
 drop table if exists t0,t1,t2,t3,t4;
 # Clear up from other tests (to ensure that SHOW TABLES below is right)
@@ -19,16 +21,16 @@ rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
 select * from t1;
 
 # The following should give errors
---error 1050,1050
+--error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
 rename table t1 to t2;
---error 1050,1050
+--error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
 rename table t1 to t1;
---error 1050,1050
+--error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
 rename table t3 to t4, t2 to t3, t1 to t2, t4 to t2;
 show tables like "t_";
---error 1050,1050
+--error ER_TABLE_EXISTS_ERROR,ER_TABLE_EXISTS_ERROR
 rename table t3 to t1, t2 to t3, t1 to t2, t4 to t1;
---error 1017,1017
+--error ER_FILE_NOT_FOUND,ER_FILE_NOT_FOUND
 rename table t3 to t4, t5 to t3, t1 to t2, t4 to t1;
 
 select * from t1;
@@ -63,28 +65,7 @@ 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;
-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;
-
+source include/wait_for_query_to_succeed.inc;
 
 show tables;
 
@@ -98,22 +79,19 @@ connection default;
 --echo End of 4.1 tests
 
 
-#
-# Bug#14959: ALTER TABLE isn't able to rename a view
-#
+--echo #
+--echo # Bug#14959: "ALTER TABLE isn't able to rename a view"
+--echo # Bug#53976: "ALTER TABLE RENAME is allowed on views
+--echo #             (not documented, broken)"
+--echo #
 create table t1(f1 int);
 create view v1 as select * from t1;
+--error ER_WRONG_OBJECT
 alter table v1 rename to v2;
---error 1146
-alter table v1 rename to v2;
-rename table v2 to v1;
---error 1050
-rename table v2 to v1;
 drop view v1;
 drop table t1;
 
+--echo End of 5.0 tests
 
---disable_query_log
+--source include/wait_until_count_sessions.inc
 drop database pbxt;
---enable_query_log
---echo End of 5.0 tests
diff --git a/mysql-test/suite/pbxt/t/select.test b/mysql-test/suite/pbxt/t/select.test
index 014f88b0e1b..a5f7186f753 100644
--- a/mysql-test/suite/pbxt/t/select.test
+++ b/mysql-test/suite/pbxt/t/select.test
@@ -1333,6 +1333,7 @@ explain select fld1 from t2 where fld1=250501 or fld1=250502 or fld1 >= 250505 a
 # If the like starts with a certain letter key will be used.
 #
 
+--sorted_result
 select fld1,fld3 from t2 where companynr = 37 and fld3 like 'f%';
 select fld3 from t2 where fld3 like "L%" and fld3 = "ok";
 select fld3 from t2 where (fld3 like "C%" and fld3 = "Chantilly");
@@ -1858,7 +1859,9 @@ select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
 select * from (t1 as t2 left join t1 as t3 using (a)) inner join t1 using ( a );
 select * from t1 inner join (t1 as t2 left join t1 as t3 using (a)) using ( a );
 # left [outer] join on
+--sorted_result
 select * from (t1 as t2 left join t1 as t3 using (a)) left outer join t1 on t1.a>1;
+--sorted_result
 select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
 # left join using
 select * from (t1 as t2 left join t1 as t3 using (a)) left join t1 using ( a );
@@ -1867,7 +1870,9 @@ select * from t1 left join (t1 as t2 left join t1 as t3 using (a)) using ( a );
 select * from (t1 as t2 left join t1 as t3 using (a)) natural left join t1;
 select * from t1 natural left join (t1 as t2 left join t1 as t3 using (a));
 # right join on
+--sorted_result
 select * from (t1 as t2 left join t1 as t3 using (a)) right join t1 on t1.a>1;
+--sorted_result
 select * from t1 right join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
 # right [outer] joing using
 select * from (t1 as t2 left join t1 as t3 using (a)) right outer join t1 using ( a );
@@ -1993,7 +1998,7 @@ DROP TABLE t1;
 #
 
 create table t1 (a int(11) unsigned, b int(11) unsigned);
-insert into t1 values (1,0), (1,1), (1,2);
+insert into t1 values (1,0), (1,1), (18446744073709551615,0);
 select a-b  from t1 order by 1;
 select a-b , (a-b < 0)  from t1 order by 1;
 select a-b as d, (a-b >= 0), b from t1 group by b having d >= 0;
@@ -2517,10 +2522,14 @@ insert into t1 values(1),(2);
 insert into t2 values(1),(2);
 create view v2 (c) as select a1 from t1;
 
+--sorted_result
 select * from t1 natural left join t2;
+--sorted_result
 select * from t1 natural right join t2;
 
+--sorted_result
 select * from v2 natural left join t2;
+--sorted_result
 select * from v2 natural right join t2;
 
 drop table t1, t2;
@@ -2689,16 +2698,20 @@ create view v3 as select (t1.id+2) as id from t1 natural left join t2;
 # all queries must return the same result
 select t1.id from t1 left join v2 using (id);
 select t1.id from v2 right join t1 using (id);
+--sorted_result
 select t1.id from t1 left join v3 using (id);
 select * from t1 left join v2 using (id);
 select * from v2 right join t1 using (id);
+--sorted_result
 select * from t1 left join v3 using (id);
 
 select v1.id from v1 left join v2 using (id);
 select v1.id from v2 right join v1 using (id);
+--sorted_result
 select v1.id from v1 left join v3 using (id);
 select * from v1 left join v2 using (id);
 select * from v2 right join v1 using (id);
+--sorted_result
 select * from v1 left join v3 using (id);
 
 drop table t1, t2;
@@ -2747,14 +2760,14 @@ create table t1(f1 int, f2 date);
 insert into t1 values(1,'2005-01-01'),(2,'2005-09-01'),(3,'2005-09-30'),
   (4,'2005-10-01'),(5,'2005-12-30');
 # should return all records
-select * from t1 where f2 >= 0;
-select * from t1 where f2 >= '0000-00-00';
+select * from t1 where f2 >= 0            order by f2;
+select * from t1 where f2 >= '0000-00-00' order by f2;
 # should return 4,5
-select * from t1 where f2 >= '2005-09-31';
-select * from t1 where f2 >= '2005-09-3a';
+select * from t1 where f2 >= '2005-09-31' order by f2;
+select * from t1 where f2 >= '2005-09-3a' order by f2;
 # should return 1,2,3
-select * from t1 where f2 <= '2005-09-31';
-select * from t1 where f2 <= '2005-09-3a';
+select * from t1 where f2 <= '2005-09-31' order by f2;
+select * from t1 where f2 <= '2005-09-3a' order by f2;
 drop table t1;
 
 #
@@ -2893,6 +2906,7 @@ DROP TABLE t1,t2;
 # cases to prevent fixing this accidently. It is intended behaviour)
 #
 
+SET SQL_MODE='NO_UNSIGNED_SUBTRACTION';
 CREATE TABLE t1 (i TINYINT UNSIGNED NOT NULL);
 INSERT t1 SET i = 0;
 UPDATE t1 SET i = -1;
@@ -2902,6 +2916,7 @@ SELECT * FROM t1;
 UPDATE t1 SET i = i - 1;
 SELECT * FROM t1;
 DROP TABLE t1;
+SET SQL_MODE=default;
 
 # BUG#17379
 
@@ -3015,16 +3030,6 @@ SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id
 
 DROP TABLE t1,t2,t3;
 
-#
-# Bug#20503: Server crash due to the ORDER clause isn't taken into account
-#            while space allocation
-#
-create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int,
-c7 int, c8 int, c9 int, fulltext key (`c1`)) engine=myisam; # PBXT: Fulltext requires MyISAM
-select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 
-  from t1 where c9=1 order by c2, c2;
-drop table t1;
-
 #
 # Bug #22735: no equality propagation for BETWEEN and IN with STRING arguments
 #
diff --git a/mysql-test/suite/pbxt/t/subselect.test b/mysql-test/suite/pbxt/t/subselect.test
index 19658cb202e..fae6d07a97e 100644
--- a/mysql-test/suite/pbxt/t/subselect.test
+++ b/mysql-test/suite/pbxt/t/subselect.test
@@ -2483,8 +2483,6 @@ DROP TABLE t1, t2;
 CREATE TABLE t1 (i INT);
 
 (SELECT i FROM t1) UNION (SELECT i FROM t1);
-#TODO:not supported
---error ER_PARSE_ERROR
 SELECT sql_no_cache * FROM t1 WHERE NOT EXISTS 
   (
    (SELECT i FROM t1) UNION 
@@ -2501,8 +2499,6 @@ WHERE NOT EXISTS (((SELECT i FROM t1) UNION (SELECT i FROM t1)));
 explain select ((select t11.i from t1 t11) union (select t12.i from t1 t12))
   from t1;
 
-#TODO:not supported
---error ER_PARSE_ERROR
 explain select * from t1 where not exists 
   ((select t11.i from t1 t11) union (select t12.i from t1 t12));
 
@@ -3159,8 +3155,6 @@ EXPLAIN EXTENDED
 SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a));
 
 
-#TODO:not supported
---error ER_PARSE_ERROR
 EXPLAIN EXTENDED
 SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION 
                                (SELECT 1 FROM t2 WHERE t1.a = t2.a));
diff --git a/mysql-test/suite/pbxt/t/type_decimal.test b/mysql-test/suite/pbxt/t/type_decimal.test
index 8f973f4ae55..f1ac16f97b0 100644
--- a/mysql-test/suite/pbxt/t/type_decimal.test
+++ b/mysql-test/suite/pbxt/t/type_decimal.test
@@ -8,13 +8,13 @@ SET SQL_WARNINGS=1;
 CREATE TABLE t1 (
    id int(11) NOT NULL auto_increment,
    datatype_id int(11) DEFAULT '0' NOT NULL,
-   minvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
-   maxvalue decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
+   min_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
+   max_value decimal(20,10) DEFAULT '0.0000000000' NOT NULL,
    valuename varchar(20),
    forecolor int(11),
    backcolor int(11),
    PRIMARY KEY (id),
-   UNIQUE datatype_id (datatype_id, minvalue, maxvalue)
+   UNIQUE datatype_id (datatype_id, min_value, max_value)
 );
 INSERT INTO t1 VALUES ( '1', '4', '0.0000000000', '0.0000000000', 'Ei saja', '0', '16776960');
 INSERT INTO t1 VALUES ( '2', '4', '1.0000000000', '1.0000000000', 'Sajab', '16777215', '255');
@@ -148,8 +148,8 @@ INSERT INTO t1 VALUES ( '139', '21', '326.0000000000', '326.0000000000', 'Lumine
 INSERT INTO t1 VALUES ( '143', '16', '-4.9000000000', '-0.1000000000', '', NULL, '15774720');
 INSERT INTO t1 VALUES ( '145', '15', '0.0000000000', '1.9000000000', '', '0', '16769024');
 INSERT INTO t1 VALUES ( '146', '16', '0.0000000000', '1.9000000000', '', '0', '16769024');
-select * from t1 where minvalue<=1 and maxvalue>=-1 and datatype_id=16;
-select * from t1 where minvalue<=-1 and maxvalue>=-1 and datatype_id=16;
+select * from t1 where min_value<=1 and max_value>=-1 and datatype_id=16;
+select * from t1 where min_value<=-1 and max_value>=-1 and datatype_id=16;
 drop table t1;
 
 #
@@ -278,7 +278,7 @@ update t1 set b=a;
 select * from t1;                                                               
 drop table t1;                                                                  
 
-# End of 4.1 tests
+--echo End of 4.1 tests
 
 #
 # Test for BUG#8397: decimal type in subselects (Item_cache_decimal)
diff --git a/mysql-test/suite/pbxt/t/type_newdecimal.test b/mysql-test/suite/pbxt/t/type_newdecimal.test
index fa2417675dd..649d5fb64f6 100644
--- a/mysql-test/suite/pbxt/t/type_newdecimal.test
+++ b/mysql-test/suite/pbxt/t/type_newdecimal.test
@@ -1054,10 +1054,8 @@ while ($max_power)
 }
 SELECT my_float, my_double, my_varchar FROM t1;
 
-# Expected result   0.000000000011754943372854760000
-# On windows we get 0.000000000011754943372854770000
-# use replace_result to correct it
---replace_result 0.000000000011754943372854770000 0.000000000011754943372854760000
+# The following statement produces results with garbage past
+# the significant digits. Improving it is a part of the WL#3977.
 SELECT CAST(my_float   AS DECIMAL(65,30)), my_float FROM t1;
 SELECT CAST(my_double  AS DECIMAL(65,30)), my_double FROM t1;
 SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
@@ -1077,12 +1075,14 @@ UPDATE t1 SET my_decimal = my_float;
 SELECT my_decimal, my_float   FROM t1;
 
 UPDATE t1 SET my_decimal = my_double;
-SELECT my_decimal, my_double  FROM t1 order by my_decimal; # PBXT required for consistent result 
+--sorted_result
+SELECT my_decimal, my_double  FROM t1;
 --enable_warnings
 --disable_warnings # PBXT The rows updated keeps changing
 UPDATE t1 SET my_decimal = my_varchar;
 --enable_warnings # PBXT The rows updated keeps changing
-SELECT my_decimal, my_varchar FROM t1 order by my_decimal, my_varchar;
+--sorted_result
+SELECT my_decimal, my_varchar FROM t1;
 
 DROP TABLE t1;
 
@@ -1094,6 +1094,7 @@ create table t1 (c1 decimal(64));
 --disable_ps_protocol
 insert into t1 values(
 89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);
+--error ER_DATA_OUT_OF_RANGE
 insert into t1 values(
 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 *
 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999);
diff --git a/mysql-test/suite/pbxt/t/type_timestamp.test b/mysql-test/suite/pbxt/t/type_timestamp.test
index 88b4c4e2587..edd2857f4d3 100644
--- a/mysql-test/suite/pbxt/t/type_timestamp.test
+++ b/mysql-test/suite/pbxt/t/type_timestamp.test
@@ -67,17 +67,6 @@ INSERT INTO t1 VALUES ("2030-01-01","2030-01-01 00:00:00",20300101000000);
 SELECT * FROM t1;
 drop table t1;
 
-create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
-                 t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
-                 t14 timestamp(14));
-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",
-"1997-12-31 23:47:59");
-select * from t1;
-select * from t1;
-drop table t1;
-
 #
 # Let us check if we properly treat wrong datetimes and produce proper warnings
 # (for both strings and numbers)
@@ -298,7 +287,7 @@ drop table t1;
 # mode regardless of whether a display width is given.
 #
 set sql_mode='maxdb';
-create table t1 (a timestamp, b timestamp(19));
+create table t1 (a timestamp, b timestamp);
 show create table t1;
 # restore default mode
 set sql_mode='';
diff --git a/mysql-test/suite/pbxt/t/union.test b/mysql-test/suite/pbxt/t/union.test
index 02c73d4bb57..fe23b27d500 100644
--- a/mysql-test/suite/pbxt/t/union.test
+++ b/mysql-test/suite/pbxt/t/union.test
@@ -253,7 +253,7 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a desc LIMIT 1;
 
 create temporary table t1 engine=myisam select a from t1 union select a from t2; # PBXT cannot handle INSERT/SELECT on temp table
 drop temporary table t1;
---error 1093
+--error ER_TABLE_EXISTS_ERROR
 create table t1 select a from t1 union select a from t2;
 --error 1054
 select a from t1 union select a from t2 order by t2.a;
diff --git a/mysql-test/suite/pbxt/t/user_var.test b/mysql-test/suite/pbxt/t/user_var.test
index f965913ef67..18d8423fefc 100644
--- a/mysql-test/suite/pbxt/t/user_var.test
+++ b/mysql-test/suite/pbxt/t/user_var.test
@@ -122,8 +122,6 @@ select coercibility(@v1),coercibility(@v2),coercibility(@v3),coercibility(@v4);
 #
 --error 1064
 set session @honk=99;
---error 1382
-set one_shot @honk=99;
 
 #
 # Bug #10724  @@local not preserved in column name of select
diff --git a/mysql-test/suite/pbxt/t/view_grant.test b/mysql-test/suite/pbxt/t/view_grant.test
index 6a105da61f8..525d9423bb1 100644
--- a/mysql-test/suite/pbxt/t/view_grant.test
+++ b/mysql-test/suite/pbxt/t/view_grant.test
@@ -32,19 +32,19 @@ grant create view,select on test.* to mysqltest_1@localhost;
 connect (user1,localhost,mysqltest_1,,test);
 connection user1;
 
--- error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--error ER_SPECIFIC_ACCESS_DENIED_ERROR
 create definer=root@localhost view v1 as select * from mysqltest.t1;
 create view v1 as select * from mysqltest.t1;
 # try to modify view without DROP privilege on it
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 alter view v1 as select * from mysqltest.t1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 create or replace view v1 as select * from mysqltest.t1;
 # no CRETE VIEW privilege
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 create view mysqltest.v2  as select * from mysqltest.t1;
 # no SELECT privilege
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 create view v2 as select * from mysqltest.t2;
 
 connection root;
@@ -54,7 +54,7 @@ show create view v1;
 grant create view,drop,select on test.* to mysqltest_1@localhost;
 
 connection user1;
-# following 'use' command is workaround of bug #9582 and should be removed
+# following 'use' command is workaround of Bug#9582 and should be removed
 # when that bug will be fixed
 use test;
 alter view v1 as select * from mysqltest.t1;
@@ -82,7 +82,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
 connection user1;
 select c from mysqltest.v1;
 # there are no privileges on column 'd'
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 select d from mysqltest.v1;
 
 connection root;
@@ -102,7 +102,7 @@ grant select (c) on mysqltest.v1 to mysqltest_1@localhost;
 connection user1;
 select c from mysqltest.v1;
 # there are no privileges on column 'd'
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 select d from mysqltest.v1;
 
 connection root;
@@ -117,7 +117,7 @@ connection root;
 --disable_warnings
 create database mysqltest;
 --enable_warnings
-#prepare views and tables
+# prepare views and tables
 create table mysqltest.t1 (a int, b int);
 create table mysqltest.t2 (a int, b int);
 create view mysqltest.v1 (c,d) as select a+1,b+1 from mysqltest.t1;
@@ -139,21 +139,21 @@ select c from mysqltest.v4;
 show columns from mysqltest.v1;
 show columns from mysqltest.v2;
 # but explain/show do not
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v1;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v2;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v2;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v3;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v3;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v4;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v4;
 
 # allow to see one of underlying table
@@ -162,19 +162,19 @@ grant select on mysqltest.t1 to mysqltest_1@localhost;
 connection user1;
 # EXPLAIN of view on above table works
 explain select c from mysqltest.v1;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v1;
 explain select c from mysqltest.v2;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v2;
 # but other EXPLAINs do not
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v3;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v3;
--- error 1345
+--error ER_VIEW_NO_EXPLAIN
 explain select c from mysqltest.v4;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 show create view mysqltest.v4;
 
 # allow to see any view in mysqltest database
@@ -228,14 +228,14 @@ select * from t1 order by a; # PBXT : required for order
 update v2 set a=a+c;
 select * from t1 order by a; # PBXT : required for order
 # no rights on column
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c;
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 update v2 set c=a+c;
 # no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 update t2,v3 set v3.a=v3.a+v3.c where t2.x=v3.c;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 update v3 set a=a+c;
 
 use test;
@@ -269,9 +269,9 @@ select * from t1;
 delete v1 from t2,v1 where t2.x=v1.c;
 select * from t1;
 # no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 delete v2 from t2,v2 where t2.x=v2.c;
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 delete from v2 where c < 4;
 
 use test;
@@ -305,9 +305,9 @@ select * from t1;
 insert into v1 select x,y from t2;
 select * from t1;
 # no rights for view
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 insert into v2 values (5,6);
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 insert into v2 select x,y from t2;
 
 use test;
@@ -335,10 +335,10 @@ connection user1;
 create view v1 as select * from mysqltest.t1;
 create view v2 as select b from mysqltest.t2;
 # There are not rights on mysqltest.v1
--- error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 create view mysqltest.v1 as select * from mysqltest.t1;
 # There are not any rights on mysqltest.t2.a
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 create view v3 as select a from mysqltest.t2;
 
 # give CREATE VIEW privileges (without any privileges for result column)
@@ -358,13 +358,13 @@ create view mysqltest.v3 as select b from mysqltest.t2;
 
 
 # Expression need select privileges
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 create view v4 as select b+1 from mysqltest.t2;
 
 connection root;
 grant create view,update,select on test.* to mysqltest_1@localhost;
 connection user1;
--- error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 create view v4 as select b+1 from mysqltest.t2;
 
 connection root;
@@ -417,7 +417,7 @@ connection root;
 # check view definer information
 show create view v1;
 revoke select on mysqltest.t1 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v1;
 grant select on mysqltest.t1 to mysqltest_1@localhost;
 select * from v1;
@@ -426,7 +426,7 @@ drop view v1;
 drop database mysqltest;
 
 #
-# rights on execution of view underlying functiond (BUG#9505)
+# rights on execution of view underlying functiond (Bug#9505)
 #
 connection root;
 --disable_warnings
@@ -459,11 +459,11 @@ connection user1;
 use mysqltest;
 select * from v1;
 select * from v2;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v3;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v5;
 use test;
 
@@ -511,13 +511,13 @@ use test;
 connection root;
 create view v5 as select * from v1;
 revoke execute on function f2 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v1;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v2;
 select * from v3;
 select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v5;
 
 drop view v1, v2, v3, v4, v5;
@@ -555,13 +555,13 @@ use test;
 
 connection root;
 revoke select on t1 from mysqltest_1@localhost;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v1;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v2;
 select * from v3;
 select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v5;
 
 #drop view v1, v2, v3, v4, v5;
@@ -594,11 +594,11 @@ connection user1;
 use mysqltest;
 select * from v1;
 select * from v2;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v3;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v4;
--- error ER_VIEW_INVALID
+--error ER_VIEW_INVALID
 select * from v5;
 use test;
 
@@ -610,10 +610,11 @@ REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
 drop database mysqltest;
 
 #
-# BUG#14256: definer in view definition is not fully qualified
+# Bug#14256 definer in view definition is not fully qualified
 #
 --disable_warnings
 drop view if exists v1;
+drop table if exists t1;
 --enable_warnings
 
 # Backup anonymous users and remove them. (They get in the way of
@@ -646,6 +647,7 @@ drop view v1;
 select @v1def1, @v1def2, @v1def1=@v1def2;
 
 connection root;
+disconnect test14256;
 drop user test14256;
 
 # Restore the anonymous users.
@@ -655,8 +657,8 @@ flush privileges;
 drop table t1;
 
 #
-# BUG#14726: freeing stack variable in case of an error of opening
-# a view when we have locked tables with LOCK TABLES statement.
+# Bug#14726 freeing stack variable in case of an error of opening a view when
+#           we have locked tables with LOCK TABLES statement.
 #
 connection root;
 --disable_warnings
@@ -673,7 +675,7 @@ connection user1;
 
 use mysqltest;
 LOCK TABLES v1 READ;
--- error ER_TABLEACCESS_DENIED_ERROR
+--error ER_TABLEACCESS_DENIED_ERROR
 SHOW CREATE TABLE v1;
 UNLOCK TABLES;
 use test;
@@ -684,7 +686,7 @@ drop user mysqltest_1@localhost;
 drop database mysqltest;
 
 #
-# switch to default connaction
+# switch to default connection
 #
 disconnect user1;
 disconnect root;
@@ -701,7 +703,7 @@ drop view v1;
 drop view v2;
 
 #
-# Bug#18681: View privileges are broken
+# Bug#18681 View privileges are broken
 #
 CREATE DATABASE mysqltest1;
 CREATE USER readonly@localhost;
@@ -722,54 +724,55 @@ GRANT UPDATE,SELECT ON mysqltest1.v_tus TO readonly@localhost;
 GRANT DELETE ON mysqltest1.v_td TO readonly@localhost;
 GRANT DELETE,SELECT ON mysqltest1.v_tds TO readonly@localhost;
 
-CONNECT (n1,localhost,readonly,,);
-CONNECTION n1;
+connect (n1,localhost,readonly,,);
+connection n1;
 
---error 1356
+--error ER_VIEW_INVALID
 SELECT * FROM mysqltest1.v_t1;
---error 1356
+--error ER_VIEW_INVALID
 INSERT INTO mysqltest1.v_t1 VALUES(4);
---error 1356
+--error ER_VIEW_INVALID
 DELETE FROM mysqltest1.v_t1 WHERE x = 1;
---error 1356
+--error ER_VIEW_INVALID
 UPDATE mysqltest1.v_t1 SET x = 3 WHERE x = 2;
---error 1356
+--error ER_VIEW_INVALID
 UPDATE mysqltest1.v_t1 SET x = 3;
---error 1356
+--error ER_VIEW_INVALID
 DELETE FROM mysqltest1.v_t1;
---error 1356
+--error ER_VIEW_INVALID
 SELECT 1 FROM mysqltest1.v_t1;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 SELECT * FROM mysqltest1.t1;
 
 SELECT * FROM mysqltest1.v_ts;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 SELECT * FROM mysqltest1.v_ts, mysqltest1.t1 WHERE mysqltest1.t1.x = mysqltest1.v_ts.x;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 SELECT * FROM mysqltest1.v_ti;
 
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 INSERT INTO mysqltest1.v_ts VALUES (100);
 INSERT INTO mysqltest1.v_ti VALUES (100);
 
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 UPDATE mysqltest1.v_ts SET x= 200 WHERE x = 100;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 UPDATE mysqltest1.v_ts SET x= 200;
 UPDATE mysqltest1.v_tu SET x= 200 WHERE x = 100;
 UPDATE mysqltest1.v_tus SET x= 200 WHERE x = 100;
 UPDATE mysqltest1.v_tu SET x= 200;
 
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 DELETE FROM mysqltest1.v_ts WHERE x= 200;
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 DELETE FROM mysqltest1.v_ts;
---error 1143
+--error ER_COLUMNACCESS_DENIED_ERROR
 DELETE FROM mysqltest1.v_td WHERE x= 200;
 DELETE FROM mysqltest1.v_tds WHERE x= 200;
 DELETE FROM mysqltest1.v_td;
 
-CONNECTION default;
+connection default;
+disconnect n1;
 DROP VIEW mysqltest1.v_tds;
 DROP VIEW mysqltest1.v_td;
 DROP VIEW mysqltest1.v_tus;
@@ -782,21 +785,21 @@ DROP USER readonly@localhost;
 DROP DATABASE mysqltest1;
 
 #
-# BUG#14875: Bad view DEFINER makes SHOW CREATE VIEW fail
+# Bug#14875 Bad view DEFINER makes SHOW CREATE VIEW fail
 #
 CREATE TABLE t1 (a INT PRIMARY KEY);
 INSERT INTO t1 VALUES (1), (2), (3);
 CREATE DEFINER = 'no-such-user'@localhost VIEW v AS SELECT a from t1;
-#--warning 1448
+#--warning ER_VIEW_OTHER_USER
 SHOW CREATE VIEW v;
---error 1449
+--error ER_NO_SUCH_USER
 SELECT * FROM v;
 DROP VIEW v;
 DROP TABLE t1;
 USE test;
 
 #
-# Bug#20363: Create view on just created view is now denied
+# Bug#20363 Create view on just created view is now denied
 #
 eval CREATE USER mysqltest_db1@localhost identified by 'PWD';
 eval GRANT ALL ON mysqltest_db1.* TO mysqltest_db1@localhost WITH GRANT OPTION;
@@ -827,6 +830,7 @@ SELECT * FROM view2;
 SELECT * from view3;
 
 connection default;
+disconnect session1;
 DROP VIEW mysqltest_db1.view3;
 DROP VIEW mysqltest_db1.view2;
 DROP VIEW mysqltest_db1.view1;
@@ -834,7 +838,7 @@ DROP TABLE mysqltest_db1.t1;
 DROP SCHEMA mysqltest_db1;
 DROP USER mysqltest_db1@localhost;
 #
-# BUG#20482: failure on Create join view with sources views/tables 
+# Bug#20482 failure on Create join view with sources views/tables
 #             in different schemas
 #
 --disable_warnings
@@ -856,8 +860,8 @@ DROP DATABASE test1;
 
 
 #
-# BUG#20570: CURRENT_USER() in a VIEW with SQL SECURITY DEFINER
-# returns invoker name
+# Bug#20570 CURRENT_USER() in a VIEW with SQL SECURITY DEFINER returns
+#           invoker name
 #
 --disable_warnings
 DROP VIEW IF EXISTS v1;
@@ -916,7 +920,7 @@ DROP USER mysqltest_u1@localhost;
 
 
 #
-# Bug#17254: Error for DEFINER security on VIEW provides too much info
+# Bug#17254 Error for DEFINER security on VIEW provides too much info
 #
 connect (root,localhost,root,,);
 connection root;
@@ -940,12 +944,12 @@ DROP USER def_17254@localhost;
 connect (inv,localhost,inv_17254,,db17254);
 connection inv;
 --echo for a user
---error 1142
+--error ER_TABLEACCESS_DENIED_ERROR
 SELECT * FROM v1;
 
 connection root;
 --echo for a superuser
---error 1449
+--error ER_NO_SUCH_USER
 SELECT * FROM v1;
 DROP USER inv_17254@localhost;
 DROP DATABASE db17254;
@@ -954,7 +958,7 @@ disconnect inv;
 
 
 #
-# BUG#24404: strange bug with view+permission+prepared statement
+# Bug#24404 strange bug with view+permission+prepared statement
 #
 --disable_warnings
 DROP DATABASE IF EXISTS mysqltest_db1;
@@ -1022,7 +1026,7 @@ DROP USER mysqltest_u1@localhost;
 DROP USER mysqltest_u2@localhost;
 
 #
-# Bug#26813: The SUPER privilege is wrongly required to alter a view created
+# Bug#26813 The SUPER privilege is wrongly required to alter a view created
 #            by another user.
 #
 connection root;
@@ -1040,9 +1044,9 @@ GRANT SELECT ON db26813.t1 TO u26813@localhost;
 
 connect (u1,localhost,u26813,,db26813);
 connection u1;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--error ER_TABLEACCESS_DENIED_ERROR 
 ALTER VIEW v1 AS SELECT f2 FROM t1;
---error ER_SPECIFIC_ACCESS_DENIED_ERROR
+--error ER_TABLEACCESS_DENIED_ERROR
 ALTER VIEW v2 AS SELECT f2 FROM t1;
 --error ER_SPECIFIC_ACCESS_DENIED_ERROR
 ALTER VIEW v3 AS SELECT f2 FROM t1;
@@ -1055,7 +1059,7 @@ DROP DATABASE db26813;
 disconnect u1;
 
 --echo #
---echo # Bug#29908: A user can gain additional access through the ALTER VIEW.
+--echo # Bug#29908 A user can gain additional access through the ALTER VIEW.
 --echo #
 connection root;
 CREATE DATABASE mysqltest_29908;
@@ -1065,12 +1069,12 @@ CREATE USER u29908_1@localhost;
 CREATE DEFINER = u29908_1@localhost VIEW v1 AS SELECT f1 FROM t1;
 CREATE DEFINER = u29908_1@localhost SQL SECURITY INVOKER VIEW v2 AS
   SELECT f1 FROM t1;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v1 TO u29908_1@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_1@localhost;
 GRANT SELECT ON mysqltest_29908.t1 TO u29908_1@localhost;
 CREATE USER u29908_2@localhost;
-GRANT DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
-GRANT DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
+GRANT SELECT, DROP, CREATE VIEW ON mysqltest_29908.v1 TO u29908_2@localhost;
+GRANT SELECT, DROP, CREATE VIEW, SHOW VIEW ON mysqltest_29908.v2 TO u29908_2@localhost;
 GRANT SELECT ON mysqltest_29908.t1 TO u29908_2@localhost;
 
 connect (u2,localhost,u29908_2,,mysqltest_29908);
@@ -1100,7 +1104,7 @@ disconnect u2;
 --echo #######################################################################
 
 #
-# BUG#24040: Create View don't succed with "all privileges" on a database.
+# Bug#24040 Create View don't succed with "all privileges" on a database.
 #
 
 # Prepare.
@@ -1184,7 +1188,7 @@ SELECT * FROM mysqltest1.t4;
 
 # Cleanup.
 
--- disconnect bug24040_con
+disconnect bug24040_con;
 
 DROP DATABASE mysqltest1;
 DROP DATABASE mysqltest2;
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 80589631909..b582ad6577e 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -3048,8 +3048,15 @@ bool ha_maria::check_if_incompatible_data(HA_CREATE_INFO *create_info,
 static int maria_hton_panic(handlerton *hton, ha_panic_function flag)
 {
   /* If no background checkpoints, we need to do one now */
-  return ((checkpoint_interval == 0) ?
-          ma_checkpoint_execute(CHECKPOINT_FULL, FALSE) : 0) | maria_panic(flag);
+  int ret=0;
+
+  if (!checkpoint_interval)
+    ret= ma_checkpoint_execute(CHECKPOINT_FULL, FALSE);
+
+  ret|= maria_panic(flag);
+
+  maria_hton= 0;
+  return ret;
 }
 
 
diff --git a/storage/oqgraph/CMakeLists.txt b/storage/oqgraph/CMakeLists.txt
index 34aaafb6fcc..caba9ce3481 100644
--- a/storage/oqgraph/CMakeLists.txt
+++ b/storage/oqgraph/CMakeLists.txt
@@ -17,5 +17,6 @@ IF(BOOST_OK)
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
   ENDIF()
 
-  MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc STORAGE_ENGINE)
+  MYSQL_ADD_PLUGIN(oqgraph ha_oqgraph.cc graphcore.cc STORAGE_ENGINE
+                   MODULE_ONLY)
 ENDIF(BOOST_OK)
diff --git a/storage/pbxt/src/ha_pbxt.cc b/storage/pbxt/src/ha_pbxt.cc
index 5b9e30a9213..1b0e0f0f5ff 100644
--- a/storage/pbxt/src/ha_pbxt.cc
+++ b/storage/pbxt/src/ha_pbxt.cc
@@ -2198,6 +2198,10 @@ MX_TABLE_TYPES_T ha_pbxt::table_flags() const
 		 */
 		HA_BINLOG_ROW_CAPABLE |
 #endif
+                /*
+                 * ha_pbxt::repair() method does not return HA_ADMIN_NOT_IMPLEMENTED
+                 */
+                HA_CAN_REPAIR |
 		/*
 		 * Auto-increment is allowed on a partial key.
 		 */
-- 
2.30.9