summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/auto_increment.result2
-rw-r--r--mysql-test/r/case.result2
-rw-r--r--mysql-test/r/commit_1innodb.result2
-rw-r--r--mysql-test/r/create.result404
-rw-r--r--mysql-test/r/ctype_binary.result150
-rw-r--r--mysql-test/r/ctype_cp1251.result150
-rw-r--r--mysql-test/r/ctype_cp932_binlog_stm.result2
-rw-r--r--mysql-test/r/ctype_latin1.result150
-rw-r--r--mysql-test/r/ctype_ucs.result147
-rw-r--r--mysql-test/r/ctype_utf16_def.result9
-rw-r--r--mysql-test/r/ctype_utf32.result36
-rw-r--r--mysql-test/r/ctype_utf8.result2766
-rw-r--r--mysql-test/r/delayed.result77
-rw-r--r--mysql-test/r/endspace.result18
-rw-r--r--mysql-test/r/events_trans.result19
-rw-r--r--mysql-test/r/flush.result139
-rw-r--r--mysql-test/r/func_gconcat.result20
-rw-r--r--mysql-test/r/func_group.result23
-rw-r--r--mysql-test/r/func_misc.result15
-rw-r--r--mysql-test/r/func_str.result25
-rw-r--r--mysql-test/r/func_time.result8
-rw-r--r--mysql-test/r/handler_read_last.result60
-rw-r--r--mysql-test/r/information_schema_inno.result12
-rw-r--r--mysql-test/r/insert_select.result1
-rw-r--r--mysql-test/r/join.result1
-rw-r--r--mysql-test/r/join_outer.result1
-rw-r--r--mysql-test/r/locale.result2
-rw-r--r--mysql-test/r/mdl_sync.result149
-rw-r--r--mysql-test/r/merge.result3
-rw-r--r--mysql-test/r/mysql_not_windows.result5
-rw-r--r--mysql-test/r/mysqlbinlog.result6
-rw-r--r--mysql-test/r/mysqlbinlog_row.result138
-rw-r--r--mysql-test/r/mysqld--help-notwin.result6
-rw-r--r--mysql-test/r/mysqld--help-win.result6
-rw-r--r--mysql-test/r/not_partition.result18
-rw-r--r--mysql-test/r/null_key.result1
-rw-r--r--mysql-test/r/partition.result6
-rw-r--r--mysql-test/r/partition_disabled.result2
-rw-r--r--mysql-test/r/partition_innodb.result98
-rw-r--r--mysql-test/r/partition_not_blackhole.result16
-rw-r--r--mysql-test/r/partition_truncate.result8
-rw-r--r--mysql-test/r/ps_ddl.result4
-rw-r--r--mysql-test/r/query_cache.result16
-rw-r--r--mysql-test/r/range.result13
-rw-r--r--mysql-test/r/rowid_order_innodb.result2
-rw-r--r--mysql-test/r/schema.result6
-rw-r--r--mysql-test/r/select.result1
-rw-r--r--mysql-test/r/single_delete_update.result42
-rw-r--r--mysql-test/r/sp-lock.result46
-rw-r--r--mysql-test/r/sp-threads.result2
-rw-r--r--mysql-test/r/subselect3.result1
-rw-r--r--mysql-test/r/trigger.result27
-rw-r--r--mysql-test/r/type_bit_innodb.result2
-rw-r--r--mysql-test/r/union.result2
-rw-r--r--mysql-test/r/update.result10
55 files changed, 4670 insertions, 207 deletions
diff --git a/mysql-test/r/auto_increment.result b/mysql-test/r/auto_increment.result
index 4a2e108f8c6..dbeedb481cd 100644
--- a/mysql-test/r/auto_increment.result
+++ b/mysql-test/r/auto_increment.result
@@ -469,7 +469,7 @@ drop table t1;
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (1);
CREATE TABLE t2 ( a INT AUTO_INCREMENT KEY );
-CREATE TABLE IF NOT EXISTS t2 AS SELECT a FROM t1;
+INSERT INTO t2 SELECT a FROM t1;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
UPDATE t2 SET a = 2;
SELECT a FROM t2;
diff --git a/mysql-test/r/case.result b/mysql-test/r/case.result
index fcbf5812312..40d900a0389 100644
--- a/mysql-test/r/case.result
+++ b/mysql-test/r/case.result
@@ -160,6 +160,8 @@ t1 CREATE TABLE `t1` (
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+CREATE TABLE t1 SELECT IFNULL('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 'ifnull'
SELECT 'case+union+test'
UNION
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
diff --git a/mysql-test/r/commit_1innodb.result b/mysql-test/r/commit_1innodb.result
index a9b04d54400..993d33d7a38 100644
--- a/mysql-test/r/commit_1innodb.result
+++ b/mysql-test/r/commit_1innodb.result
@@ -830,7 +830,7 @@ create table if not exists t2 (a int) select 6 union select 7;
Warnings:
Note 1050 Table 't2' already exists
# Sic: first commits the statement, and then the transaction.
-call p_verify_status_increment(2, 0, 4, 4);
+call p_verify_status_increment(2, 0, 2, 0);
SUCCESS
create table t3 select a from t2;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index fce775c5952..d5f3945fb6b 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/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;
@@ -264,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));
@@ -280,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 2
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 '
@@ -611,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;
@@ -811,7 +804,8 @@ 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;
-ERROR 21S01: Column count doesn't match value count at row 1
+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'
@@ -823,25 +817,14 @@ Warnings:
Note 1050 Table 't1' already exists
select * from t1;
i
-1
create table if not exists t1 select * from t1;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+Warnings:
+Note 1050 Table 't1' already exists
select * from t1;
i
-1
+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'
-select * from t1;
-i
-1
-alter table t1 add primary key (i);
-create table if not exists t1 (select 2 as i) union all (select 2 as i);
-ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
-select * from t1;
-i
-1
-2
-drop table t1;
create temporary table t1 (j int);
create table if not exists t1 select 1;
select * from t1;
@@ -893,8 +876,6 @@ select * from t2;
i
1
2
-1
-2
unlock tables;
drop table t1, t2;
create table t1 (upgrade int);
@@ -1561,6 +1542,7 @@ 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 0
@@ -1586,11 +1568,9 @@ 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;
-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'
-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'
DROP TABLE t1, t2;
#
@@ -1620,7 +1600,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
@@ -1633,13 +1613,7 @@ a b
1 1
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
-1 1
-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
@@ -1964,11 +1938,7 @@ CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
INSERT INTO t1 ( `int` ) VALUES (4 ),( 8 ),( 2 ) ;
END ; |
-CREATE TABLE IF NOT EXISTS t1 (
-`pk` INTEGER NOT NULL AUTO_INCREMENT ,
-`int` INTEGER ,
-PRIMARY KEY ( `pk` )
-) SELECT `pk` , `int_key` FROM B ;
+INSERT INTO t1 (pk, int_key) SELECT `pk` , `int_key` FROM B ;
ERROR HY000: Can't update table 't1' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.
CREATE TRIGGER f BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
@@ -2088,3 +2058,347 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
set @@sql_mode= @old_mode;
drop tables t1, t2;
+CREATE TABLE t1 (id int);
+CREATE TABLE t2 (id int);
+INSERT INTO t1 VALUES (1), (1);
+INSERT INTO t2 VALUES (2), (2);
+CREATE VIEW v1 AS SELECT id FROM t2;
+CREATE TABLE IF NOT EXISTS v1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'v1' already exists
+SHOW CREATE TABLE v1;
+View Create View character_set_client collation_connection
+v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t2`.`id` AS `id` from `t2` latin1 latin1_swedish_ci
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM v1;
+id
+2
+2
+DROP VIEW v1;
+CREATE TEMPORARY TABLE tt1 AS SELECT id FROM t2;
+CREATE TEMPORARY TABLE IF NOT EXISTS tt1(a int, b int) SELECT id, id FROM t1;
+Warnings:
+Note 1050 Table 'tt1' already exists
+SELECT * FROM t2;
+id
+2
+2
+SELECT * FROM tt1;
+id
+2
+2
+DROP TEMPORARY TABLE tt1;
+DROP TABLE t1, t2;
+#
+# WL#5370 "Changing 'CREATE TABLE IF NOT EXISTS ... SELECT'
+# behaviour.
+#
+#
+# 1. Basic case: a base table.
+#
+create table if not exists t1 (a int) select 1 as a;
+select * from t1;
+a
+1
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Produces an essential warning ER_TABLE_EXISTS.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+# No new data in t1.
+select * from t1;
+a
+1
+drop table t1;
+#
+# 2. A temporary table.
+#
+create temporary table if not exists t1 (a int) select 1 as a;
+select * from t1;
+a
+1
+create temporary table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# An essential warning.
+create temporary table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+# No new data in t1.
+select * from t1;
+a
+1
+drop temporary table t1;
+#
+# 3. Creating a base table in presence of a temporary table.
+#
+create table t1 (a int);
+# Create a view for convenience of querying t1 shadowed by a temp.
+create view v1 as select a from t1;
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select 2 as a;
+select * from t1;
+a
+1
+select * from v1;
+a
+2
+# Note: an essential warning.
+create table if not exists t1 (a int) select 3 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+select * from v1;
+a
+2
+drop temporary table t1;
+select * from t1;
+a
+2
+drop view v1;
+drop table t1;
+#
+# 4. Creating a temporary table in presence of a base table.
+#
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 select 2 as a;
+select * from t1;
+a
+2
+# Note: an essential warning.
+create temporary table if not exists t1 select 3 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+2
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+#
+# 5. Creating a base table in presence of an updatable view.
+#
+create table t2 (a int unique);
+create view t1 as select a from t2;
+insert into t1 (a) values (1);
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+select * from t2;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+drop temporary table t1;
+#
+# Repeating the test with a non-updatable view.
+#
+drop view t1;
+create view t1 as select a + 5 as a from t2;
+insert into t1 (a) values (1);
+ERROR HY000: The target table t1 of the INSERT is not insertable-into
+update t1 set a=3 where a=2;
+ERROR HY000: Column 'a' is not updatable
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+6
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+6
+select * from t2;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+select * from t2;
+a
+1
+drop temporary table t1;
+drop view t1;
+drop table t2;
+#
+# Repeating the test with a view select a constant number
+#
+create view t1 as select 1 as a;
+insert into t1 (a) values (1);
+ERROR HY000: The target table t1 of the INSERT is not insertable-into
+update t1 set a=3 where a=2;
+ERROR HY000: The target table t1 of the UPDATE is not updatable
+create table t1 (a int);
+ERROR 42S01: Table 't1' already exists
+# Note: an essential warning.
+create table if not exists t1 (a int);
+Warnings:
+Note 1050 Table 't1' already exists
+create table t1 (a int) select 2 as a;
+ERROR 42S01: Table 't1' already exists
+select * from t1;
+a
+1
+# Note: an essential warning.
+create table if not exists t1 (a int) select 2 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+create temporary table if not exists t1 (a int) select 3 as a;
+select * from t1;
+a
+3
+# Note: an essential warning.
+create temporary table if not exists t1 (a int) select 4 as a;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+3
+drop temporary table t1;
+drop view t1;
+#
+# 6. Test of unique_table().
+#
+create table t1 (a int) select 1 as a;
+create temporary table if not exists t1 (a int) select * from t1;
+create temporary table if not exists t1 (a int) select * from t1;
+ERROR HY000: Can't reopen table: 't1'
+select * from t1;
+a
+1
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+create temporary table t1 (a int) select 1 as a;
+create table if not exists t1 (a int) select * from t1;
+create table if not exists t1 (a int) select * from t1;
+Warnings:
+Note 1050 Table 't1' already exists
+select * from t1;
+a
+1
+drop temporary table t1;
+select * from t1;
+a
+1
+drop table t1;
+create table if not exists t1 (a int) select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+#
+# 7. Test of non-matching columns, REPLACE and IGNORE.
+#
+create table t1 (a int) select 1 as b, 2 as c;
+select * from t1;
+a b c
+NULL 1 2
+drop table t1;
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'c' at row 1
+select * from t1;
+a b c
+NULL 0000-00-00 0000-00-00
+drop table t1;
+set @@session.sql_mode='STRICT_ALL_TABLES';
+create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c;
+ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table if not exists t1 (a int, b date, c date)
+replace select 1 as b, 2 as c;
+ERROR 22007: Incorrect date value: '1' for column 'b' at row 1
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+create table if not exists t1 (a int, b date, c date)
+ignore select 1 as b, 2 as c;
+Warnings:
+Warning 1264 Out of range value for column 'b' at row 1
+Warning 1264 Out of range value for column 'c' at row 1
+select * from t1;
+a b c
+NULL 0000-00-00 0000-00-00
+set @@session.sql_mode=default;
+drop table t1;
+create table if not exists t1 (a int unique, b int)
+replace select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+a b
+1 2
+drop table t1;
+create table if not exists t1 (a int unique, b int)
+ignore select 1 as a, 1 as b union select 1 as a, 2 as b;
+select * from t1;
+a b
+1 1
+drop table t1;
+#
diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result
index 76a4d0f3cf3..0e8fe328589 100644
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@ -2598,6 +2598,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
binary binary
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+binary
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 128 31 63
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varbinary(9) DEFAULT NULL,
+ `IFNULL(a,'')` varbinary(9) NOT NULL DEFAULT '',
+ `IF(a,a,'')` varbinary(9) DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varbinary(9) DEFAULT NULL,
+ `COALESCE(a,'')` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varbinary(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varbinary(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varbinary(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varbinary(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varbinary(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varbinary(5) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varbinary(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varbinary(64) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result
index f93cb5f9a12..b1e9ff38d26 100644
--- a/mysql-test/r/ctype_cp1251.result
+++ b/mysql-test/r/ctype_cp1251.result
@@ -2680,6 +2680,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
cp1251 cp1251_general_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+cp1251_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 51
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET cp1251 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET cp1251 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET cp1251 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_cp932_binlog_stm.result b/mysql-test/r/ctype_cp932_binlog_stm.result
index 2794538e097..8331e18f3f4 100644
--- a/mysql-test/r/ctype_cp932_binlog_stm.result
+++ b/mysql-test/r/ctype_cp932_binlog_stm.result
@@ -47,7 +47,7 @@ master-bin.000001 # Query # # BEGIN
master-bin.000001 # Query # # use `test`; INSERT INTO t4 VALUES ( NAME_CONST('ins1',_latin1 0x466F6F2773206120426172 COLLATE 'latin1_swedish_ci'), NAME_CONST('ins2',_cp932 0xED40ED41ED42 COLLATE 'cp932_japanese_ci'), NAME_CONST('ind',47.93))
master-bin.000001 # Query # # COMMIT
master-bin.000001 # Query # # use `test`; DROP PROCEDURE bug18293
-master-bin.000001 # Query # # use `test`; DROP TABLE t4
+master-bin.000001 # Query # # use `test`; DROP TABLE `t4` /* generated by server */
End of 5.0 tests
SHOW BINLOG EVENTS FROM 490;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result
index 43ee365cd53..6216819d172 100644
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@ -3008,6 +3008,156 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
latin1 latin1_swedish_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+latin1_swedish_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 8
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result
index 7bb27e03acc..1215eb1db02 100644
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@ -3840,6 +3840,153 @@ SELECT charset(@x), collation(@x);
charset(@x) collation(@x)
ucs2 ucs2_general_ci
#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+ucs2_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 9 7 Y 0 31 8
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET ucs2 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET ucs2 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET ucs2 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
# Bug#52159 returning time type from function and empty left join causes debug assertion
#
CREATE FUNCTION f1() RETURNS TIME RETURN 1;
diff --git a/mysql-test/r/ctype_utf16_def.result b/mysql-test/r/ctype_utf16_def.result
new file mode 100644
index 00000000000..6514734cb38
--- /dev/null
+++ b/mysql-test/r/ctype_utf16_def.result
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'collation_server';
+Variable_name Value
+collation_server utf16_general_ci
+SHOW VARIABLES LIKE 'character_set_server';
+Variable_name Value
+character_set_server utf16
+SHOW VARIABLES LIKE 'ft_stopword_file';
+Variable_name Value
+ft_stopword_file (built-in)
diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result
index 9f395f87be7..eb8ef31c8e4 100644
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@ -1091,5 +1091,41 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
#
+# Bug#45263 utf32_general_ci, bad effects around CREATE TABLE AS SELECT
+#
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT HEX(0x00) AS my_col;
+SELECT * FROM t1;
+my_col
+00
+DROP TABLE t1;
+#
+# Bug#55912 FORMAT with locale set fails for numbers < 1000
+#
+SET collation_connection=utf32_general_ci;
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `format(123,2,'no_NO')` varchar(37) CHARACTER SET utf32 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+format(123,2,'no_NO')
+123,00
+DROP TABLE t1;
+#
+# Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' faied
+#
+CREATE TABLE t1 (
+b char(250) CHARACTER SET utf32,
+key (b)
+) ENGINE=MYISAM;
+INSERT INTO t1 VALUES ('d'),('f');
+SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z';
+b
+d
+f
+DROP TABLE t1;
+#
# End of 5.5 tests
#
diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result
index a4e7c4ef53a..e14b54b59a3 100644
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@ -2087,6 +2087,2772 @@ t2 CREATE TABLE `t2` (
`CONCAT(s1)` varchar(255) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1, t2;
+SET NAMES utf8;
+#
+# Start of WL#2649 Number-to-string conversions
+#
+select hex(concat(1));
+hex(concat(1))
+31
+create table t1 as select concat(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+31
+drop table t1;
+select hex(concat(18446744073709551615));
+hex(concat(18446744073709551615))
+3138343436373434303733373039353531363135
+create table t1 as select concat(18446744073709551615) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+3138343436373434303733373039353531363135
+drop table t1;
+select hex(concat(1.1));
+hex(concat(1.1))
+312E31
+create table t1 as select concat(1.1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1;
+hex(c1)
+312E31
+drop table t1;
+select hex(concat('a', 1+2)), charset(concat(1+2));
+hex(concat('a', 1+2)) charset(concat(1+2))
+6133 utf8
+create table t1 as select concat(1+2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1-2));
+hex(concat(1-2))
+2D31
+create table t1 as select concat(1-2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1*2));
+hex(concat(1*2))
+32
+create table t1 as select concat(1*2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1/2));
+hex(concat(1/2))
+302E35303030
+create table t1 as select concat(1/2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 div 2));
+hex(concat(1 div 2))
+30
+create table t1 as select concat(1 div 2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1 % 2));
+hex(concat(1 % 2))
+31
+create table t1 as select concat(1 % 2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-1));
+hex(concat(-1))
+2D31
+create table t1 as select concat(-1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(-(1+2)));
+hex(concat(-(1+2)))
+2D33
+create table t1 as select concat(-(1+2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1|2));
+hex(concat(1|2))
+33
+create table t1 as select concat(1|2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(1&2));
+hex(concat(1&2))
+30
+create table t1 as select concat(1&2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_count(12)));
+hex(concat(bit_count(12)))
+32
+create table t1 as select concat(bit_count(12)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2<<1));
+hex(concat(2<<1))
+34
+create table t1 as select concat(2<<1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(2>>1));
+hex(concat(2>>1))
+31
+create table t1 as select concat(2>>1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(~0));
+hex(concat(~0))
+3138343436373434303733373039353531363135
+create table t1 as select concat(~0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(3^2));
+hex(concat(3^2))
+31
+create table t1 as select concat(3^2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(abs(-2)));
+hex(concat(abs(-2)))
+32
+create table t1 as select concat(abs(-2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(exp(2)),1));
+hex(left(concat(exp(2)),1))
+37
+create table t1 as select concat(exp(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log(2)),1));
+hex(left(concat(log(2)),1))
+30
+create table t1 as select concat(log(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log2(2)),1));
+hex(left(concat(log2(2)),1))
+31
+create table t1 as select concat(log2(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(log10(2)),1));
+hex(left(concat(log10(2)),1))
+30
+create table t1 as select concat(log10(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sqrt(2)),1));
+hex(left(concat(sqrt(2)),1))
+31
+create table t1 as select concat(sqrt(2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(pow(2,2)),1));
+hex(left(concat(pow(2,2)),1))
+34
+create table t1 as select concat(pow(2,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(acos(0.5)),1));
+hex(left(concat(acos(0.5)),1))
+31
+create table t1 as select concat(acos(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(asin(0.5)),1));
+hex(left(concat(asin(0.5)),1))
+30
+create table t1 as select concat(asin(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(atan(0.5)),1));
+hex(left(concat(atan(0.5)),1))
+30
+create table t1 as select concat(atan(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(cos(0.5)),1));
+hex(left(concat(cos(0.5)),1))
+30
+create table t1 as select concat(cos(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(sin(0.5)),1));
+hex(left(concat(sin(0.5)),1))
+30
+create table t1 as select concat(sin(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(tan(0.5)),1));
+hex(left(concat(tan(0.5)),1))
+30
+create table t1 as select concat(tan(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(degrees(0)));
+hex(concat(degrees(0)))
+30
+create table t1 as select concat(degrees(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(radians(0)));
+hex(concat(radians(0)))
+30
+create table t1 as select concat(radians(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ceiling(0.5)));
+hex(concat(ceiling(0.5)))
+31
+create table t1 as select concat(ceiling(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(floor(0.5)));
+hex(concat(floor(0.5)))
+30
+create table t1 as select concat(floor(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(round(0.5)));
+hex(concat(round(0.5)))
+31
+create table t1 as select concat(round(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sign(0.5)));
+hex(concat(sign(0.5)))
+31
+create table t1 as select concat(sign(0.5)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(rand()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(length('a')));
+hex(concat(length('a')))
+31
+create table t1 as select concat(length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(char_length('a')));
+hex(concat(char_length('a')))
+31
+create table t1 as select concat(char_length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(bit_length('a')));
+hex(concat(bit_length('a')))
+38
+create table t1 as select concat(bit_length('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coercibility('a')));
+hex(concat(coercibility('a')))
+34
+create table t1 as select concat(coercibility('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(locate('a','a')));
+hex(concat(locate('a','a')))
+31
+create table t1 as select concat(locate('a','a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(11) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(field('c','a','b','c')));
+hex(concat(field('c','a','b','c')))
+33
+create table t1 as select concat(field('c','a','b','c')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ascii(61)));
+hex(concat(ascii(61)))
+3534
+create table t1 as select concat(ascii(61)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ord(61)));
+hex(concat(ord(61)))
+3534
+create table t1 as select concat(ord(61)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(find_in_set('b','a,b,c,d')));
+hex(concat(find_in_set('b','a,b,c,d')))
+32
+create table t1 as select concat(find_in_set('b','a,b,c,d')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select md5('a'), hex(md5('a'));
+md5('a') hex(md5('a'))
+0cc175b9c0f1b6a831c399e269772661 3063633137356239633066316236613833316333393965323639373732363631
+create table t1 as select md5('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select old_password('a'), hex(old_password('a'));
+old_password('a') hex(old_password('a'))
+60671c896665c3fa 36303637316338393636363563336661
+create table t1 as select old_password('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(16) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select password('a'), hex(password('a'));
+password('a') hex(password('a'))
+*667F407DE7C6AD07358FA38DAED7828A72014B4E 2A36363746343037444537433641443037333538464133384441454437383238413732303134423445
+create table t1 as select password('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(41) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha('a'), hex(sha('a'));
+sha('a') hex(sha('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select sha1('a'), hex(sha1('a'));
+sha1('a') hex(sha1('a'))
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 38366637653433376661613561376663653135643164646362396561656165613337373636376238
+create table t1 as select sha1('a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(40) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('-1' as signed)));
+hex(concat(cast('-1' as signed)))
+2D31
+create table t1 as select concat(cast('-1' as signed)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('1' as unsigned)));
+hex(concat(cast('1' as unsigned)))
+31
+create table t1 as select concat(cast('1' as unsigned)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast(1/2 as decimal(5,5))));
+hex(concat(cast(1/2 as decimal(5,5))))
+302E3530303030
+create table t1 as select concat(cast(1/2 as decimal(5,5))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(7) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as date)));
+hex(concat(cast('2001-01-02 03:04:05' as date)))
+323030312D30312D3032
+create table t1 as select concat(cast('2001-01-02 03:04:05' as date)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02
+drop table t1;
+select hex(concat(cast('2001-01-02 03:04:05' as time)));
+hex(concat(cast('2001-01-02 03:04:05' as time)))
+30333A30343A3035
+create table t1 as select concat(cast('2001-01-02 03:04:05' as time)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+03:04:05
+drop table t1;
+select hex(concat(cast('2001-01-02' as datetime)));
+hex(concat(cast('2001-01-02' as datetime)))
+323030312D30312D30322030303A30303A3030
+create table t1 as select concat(cast('2001-01-02' as datetime)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2001-01-02 00:00:00
+drop table t1;
+select hex(concat(least(1,2)));
+hex(concat(least(1,2)))
+31
+create table t1 as select concat(least(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(greatest(1,2)));
+hex(concat(greatest(1,2)))
+32
+create table t1 as select concat(greatest(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(case when 11 then 22 else 33 end));
+hex(concat(case when 11 then 22 else 33 end))
+3232
+create table t1 as select concat(case when 11 then 22 else 33 end) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(coalesce(1,2)));
+hex(concat(coalesce(1,2)))
+31
+create table t1 as select concat(coalesce(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat_ws(1,2,3));
+hex(concat_ws(1,2,3))
+323133
+create table t1 as select concat_ws(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(group_concat(1,2,3));
+hex(group_concat(1,2,3))
+313233
+create table t1 as select group_concat(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(342) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select 1 as c1 union select 'a';
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select hex(c1) from t1 order by c1;
+hex(c1)
+31
+61
+drop table t1;
+create table t1 as select concat(last_insert_id()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(benchmark(0,0)));
+hex(concat(benchmark(0,0)))
+30
+create table t1 as select concat(benchmark(0,0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sleep(0)));
+hex(concat(sleep(0)))
+30
+create table t1 as select concat(sleep(0)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(is_free_lock('xxxx')));
+hex(concat(is_free_lock('xxxx')))
+31
+create table t1 as select concat(is_free_lock('xxxx')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(is_used_lock('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(release_lock('a')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(crc32('')));
+hex(concat(crc32('')))
+30
+create table t1 as select concat(crc32('')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(uncompressed_length('')));
+hex(concat(uncompressed_length('')))
+30
+create table t1 as select concat(uncompressed_length('')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(connection_id()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_aton('127.1.1.1')));
+hex(concat(inet_aton('127.1.1.1')))
+32313330373732323235
+create table t1 as select concat(inet_aton('127.1.1.1')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(inet_ntoa(2130772225)));
+hex(concat(inet_ntoa(2130772225)))
+3132372E312E312E31
+create table t1 as select concat(inet_ntoa(2130772225)) as c1;
+select * from t1;
+c1
+127.1.1.1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(31) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select 1;
+1
+1
+select hex(concat(row_count()));
+hex(concat(row_count()))
+2D31
+create table t1 as select concat(row_count()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(found_rows()));
+hex(concat(found_rows()))
+30
+create table t1 as select concat(found_rows()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid_short()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(uuid()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(36) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select coercibility(uuid()), coercibility(cast('a' as char character set latin1));
+coercibility(uuid()) coercibility(cast('a' as char character set latin1))
+4 2
+select charset(concat(uuid(), cast('a' as char character set latin1)));
+charset(concat(uuid(), cast('a' as char character set latin1)))
+latin1
+create table t1 as select concat(uuid(), cast('a' as char character set latin1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(master_pos_wait('non-existent',0,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1));
+hex(concat(@a1:=1))
+31
+create table t1 as select concat(@a2:=2) as c1, @a3:=3 as c2;
+select hex(c1) from t1;
+hex(c1)
+32
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` int(1) NOT NULL DEFAULT '0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1;
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` bigint(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=sqrt(1)));
+hex(concat(@a1:=sqrt(1)))
+31
+create table t1 as select concat(@a2:=sqrt(1)) as c1, @a3:=sqrt(1) as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=sqrt(1);
+select hex(concat(@a2));
+hex(concat(@a2))
+31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` double DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@a1:=1.1));
+hex(concat(@a1:=1.1))
+312E31
+create table t1 as select concat(@a2:=1.1) as c1, @a3:=1.1 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `c2` decimal(2,1) NOT NULL DEFAULT '0.0'
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+set @a2=1.1;
+select hex(concat(@a2));
+hex(concat(@a2))
+312E31
+create table t1 as select concat(@a2) as c1, @a2 as c2;
+select hex(c1) from t1;
+hex(c1)
+312E31
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(83) CHARACTER SET utf8 DEFAULT NULL,
+ `c2` decimal(65,30) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(@@ft_max_word_len));
+hex(concat(@@ft_max_word_len))
+3834
+create table t1 as select concat(@@ft_max_word_len) as c1;
+select hex(c1) from t1;
+hex(c1)
+3834
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS TRUE));
+hex(concat('a'='a' IS TRUE))
+31
+create table t1 as select concat('a'='a' IS TRUE) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a'='a' IS NOT TRUE));
+hex(concat('a'='a' IS NOT TRUE))
+30
+create table t1 as select concat('a'='a' IS NOT TRUE) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NOT 'a'='a'));
+hex(concat(NOT 'a'='a'))
+30
+create table t1 as select concat(NOT 'a'='a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NULL));
+hex(concat('a' IS NULL))
+30
+create table t1 as select concat('a' IS NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' IS NOT NULL));
+hex(concat('a' IS NOT NULL))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' rlike 'a'));
+hex(concat('a' rlike 'a'))
+31
+create table t1 as select concat('a' IS NOT NULL) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(strcmp('a','b')));
+hex(concat(strcmp('a','b')))
+2D31
+create table t1 as select concat(strcmp('a','b')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' like 'a'));
+hex(concat('a' like 'a'))
+31
+create table t1 as select concat('a' like 'b') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' between 'b' and 'c'));
+hex(concat('a' between 'b' and 'c'))
+30
+create table t1 as select concat('a' between 'b' and 'c') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat('a' in ('a','b')));
+hex(concat('a' in ('a','b')))
+31
+create table t1 as select concat('a' in ('a','b')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(interval(23, 1, 15, 17, 30, 44, 200)));
+hex(concat(interval(23, 1, 15, 17, 30, 44, 200)))
+33
+create table t1 as select concat(interval(23, 1, 15, 17, 30, 44, 200)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 (a varchar(10), fulltext key(a));
+insert into t1 values ('a');
+select hex(concat(match (a) against ('a'))) from t1;
+hex(concat(match (a) against ('a')))
+30
+create table t2 as select concat(match (a) against ('a')) as a from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+select hex(ifnull(1,'a'));
+hex(ifnull(1,'a'))
+31
+create table t1 as select ifnull(1,'a') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1,1)));
+hex(concat(ifnull(1,1)))
+31
+create table t1 as select concat(ifnull(1,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(ifnull(1.1,1.1)));
+hex(concat(ifnull(1.1,1.1)))
+312E31
+create table t1 as select concat(ifnull(1.1,1.1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,'b',1));
+hex(if(1,'b',1))
+62
+create table t1 as select if(1,'b',1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(if(1,1,'b'));
+hex(if(1,1,'b'))
+31
+create table t1 as select if(1,1,'b') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(if(1,1,1)));
+hex(concat(if(1,1,1)))
+31
+create table t1 as select concat(if(1,1,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(nullif(1,2)));
+hex(concat(nullif(1,2)))
+31
+create table t1 as select concat(nullif(1,2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(Dimension(GeomFromText('LINESTRING(0 0,10 10)'))))
+31
+create table t1 as select concat(Dimension(GeomFromText('LINSTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+32
+create table t1 as select concat(NumGeometries(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))));
+hex(concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))))
+32
+create table t1 as select concat(NumPoints(MultiPointFromText('LINESTRING(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))));
+hex(concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))))
+30
+create table t1 as select concat(SRID(MultiPointFromText('MULTIPOINT(0 0,10 10)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))));
+hex(concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))))
+31
+create table t1 as select concat(NumInteriorRings(PolygonFromText('POLYGON((0 0,50 0,50 50,0 50,0 0), (10 10,20 10,20 20,10 20,10 10))'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))));
+hex(concat(IsEmpty(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsEmpty(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsSimple(GeomFromText('POINT(1 1)'))));
+hex(concat(IsSimple(GeomFromText('POINT(1 1)'))))
+30
+create table t1 as select concat(IsSimple(GeomFromText('Point(1 1)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))));
+hex(concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))))
+30
+create table t1 as select concat(IsClosed(GeomFromText('LineString(1 1,2 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))));
+hex(concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))))
+31
+create table t1 as select concat(Equals(GeomFromText('Point(1 1)'),GeomFromText('Point(1 1)'))) as c1;
+drop table t1;
+select hex(concat(x(GeomFromText('Point(1 2)'))));
+hex(concat(x(GeomFromText('Point(1 2)'))))
+31
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(y(GeomFromText('Point(1 2)'))));
+hex(concat(y(GeomFromText('Point(1 2)'))))
+32
+create table t1 as select concat(x(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))));
+hex(concat(GLength(GeomFromText('LineString(1 2,2 2)'))))
+31
+create table t1 as select concat(GLength(GeomFromText('LineString(1 2, 2 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))));
+hex(concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))))
+31
+create table t1 as select concat(Area(GeomFromText('Polygon((0 0,1 0,1 1,0 1,0 0))'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(GeometryType(GeomFromText('Point(1 2)'))));
+hex(concat(GeometryType(GeomFromText('Point(1 2)'))))
+504F494E54
+create table t1 as select concat(GeometryType(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(AsText(GeomFromText('Point(1 2)'))));
+hex(concat(AsText(GeomFromText('Point(1 2)'))))
+504F494E542831203229
+create table t1 as select concat(AsText(GeomFromText('Point(1 2)'))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` longtext CHARACTER SET utf8
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_add(200902, 2)));
+hex(concat(period_add(200902, 2)))
+323030393034
+create table t1 as select concat(period_add(200902, 2)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(period_diff(200902, 200802)));
+hex(concat(period_diff(200902, 200802)))
+3132
+create table t1 as select concat(period_add(200902, 200802)) as c1;
+Warnings:
+Warning 1265 Data truncated for column 'c1' at row 1
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(to_days(20090224)));
+hex(concat(to_days(20090224)))
+373333383237
+create table t1 as select concat(to_days(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofmonth(20090224)));
+hex(concat(dayofmonth(20090224)))
+3234
+create table t1 as select concat(dayofmonth(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofyear(20090224)));
+hex(concat(dayofyear(20090224)))
+3535
+create table t1 as select concat(dayofyear(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(hour('10:11:12')));
+hex(concat(hour('10:11:12')))
+3130
+create table t1 as select concat(hour('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(minute('10:11:12')));
+hex(concat(minute('10:11:12')))
+3131
+create table t1 as select concat(minute('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(second('10:11:12')));
+hex(concat(second('10:11:12')))
+3132
+create table t1 as select concat(second('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(quarter(20090224)));
+hex(concat(quarter(20090224)))
+31
+create table t1 as select concat(quarter(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(week(20090224)));
+hex(concat(week(20090224)))
+38
+create table t1 as select concat(week(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(yearweek(20090224)));
+hex(concat(yearweek(20090224)))
+323030393038
+create table t1 as select concat(yearweek(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(year(20090224)));
+hex(concat(year(20090224)))
+32303039
+create table t1 as select concat(year(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(weekday(20090224)));
+hex(concat(weekday(20090224)))
+31
+create table t1 as select concat(weekday(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(dayofweek(20090224)));
+hex(concat(dayofweek(20090224)))
+33
+create table t1 as select concat(dayofweek(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(unix_timestamp(20090224)));
+hex(concat(unix_timestamp(20090224)))
+31323335343232383030
+create table t1 as select concat(unix_timestamp(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(time_to_sec('10:11:12')));
+hex(concat(time_to_sec('10:11:12')))
+3336363732
+create table t1 as select concat(time_to_sec('10:11:12')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(extract(year from 20090702)));
+hex(concat(extract(year from 20090702)))
+32303039
+create table t1 as select concat(extract(year from 20090702)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(microsecond('12:00:00.123456')));
+hex(concat(microsecond('12:00:00.123456')))
+313233343536
+create table t1 as select concat(microsecond('12:00:00.123456')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(21) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(month(20090224)));
+hex(concat(month(20090224)))
+32
+create table t1 as select concat(month(20090224)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(last_day('2003-02-05')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2003-02-28 323030332D30322D3238
+drop table t1;
+create table t1 as select concat(from_days(730669)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2000-07-03 323030302D30372D3033
+drop table t1;
+create table t1 as select concat(curdate()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_date()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(curtime()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(8) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat('a',20) as c1 limit 0;
+set timestamp=1216359724;
+insert into t1 values (current_date);
+insert into t1 values (current_time);
+select c1, hex(c1) from t1;
+c1 hex(c1)
+2008-07-18 323030382D30372D3138
+08:42:04 30383A34323A3034
+drop table t1;
+create table t1 as select concat(utc_time()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(8) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(sec_to_time(2378)));
+hex(concat(sec_to_time(2378)))
+30303A33393A3338
+create table t1 as select concat(sec_to_time(2378)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')));
+hex(concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')))
+32343A30303A3030
+create table t1 as select concat(timediff('2001-01-02 00:00:00', '2001-01-01 00:00:00')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(maketime(10,11,12)));
+hex(concat(maketime(10,11,12)))
+31303A31313A3132
+create table t1 as select concat(maketime(10,11,12)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(23) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(get_format(DATE,'USA'));
+hex(get_format(DATE,'USA'))
+256D2E25642E2559
+create table t1 as select get_format(DATE,'USA') as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(17) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(concat(from_unixtime(1111885200)),4));
+hex(left(concat(from_unixtime(1111885200)),4))
+32303035
+create table t1 as select concat(from_unixtime(1111885200)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')));
+hex(concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')))
+323030332D31322D33312032303A30303A3030
+create table t1 as select concat(convert_tz('2004-01-01 12:00:00','+10:00','-6:00')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)));
+hex(concat(date_add('2004-01-01 12:00:00', interval 1 day)))
+323030342D30312D30322031323A30303A3030
+create table t1 as select concat(date_add('2004-01-01 12:00:00', interval 1 day)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2004-01-02 12:00:00
+drop table t1;
+select hex(concat(makedate(2009,1)));
+hex(concat(makedate(2009,1)))
+323030392D30312D3031
+create table t1 as select concat(makedate(2009,1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+select * from t1;
+c1
+2009-01-01
+drop table t1;
+create table t1 as select concat(now()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(utc_timestamp()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(sysdate()) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(addtime('00:00:00','11:22:33')));
+hex(concat(addtime('00:00:00','11:22:33')))
+31313A32323A3333
+create table t1 as select concat(addtime('00:00:00','11:22:33')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(concat(subtime('23:59:59','11:22:33')));
+hex(concat(subtime('23:59:59','11:22:33')))
+31323A33373A3236
+create table t1 as select concat(subtime('23:59:59','11:22:33')) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(29) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(elt(1,2,3));
+hex(elt(1,2,3))
+32
+create table t1 as select elt(1,2,3) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(export_set(1,2,3,4,2));
+hex(export_set(1,2,3,4,2))
+323433
+create table t1 as select export_set(1,2,3,4,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(127) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(insert(1133,3,0,22));
+hex(insert(1133,3,0,22))
+313132323333
+create table t1 as select insert(1133,3,0,22) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lcase(123));
+hex(lcase(123))
+313233
+create table t1 as select lcase(123) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(left(123,1));
+hex(left(123,1))
+31
+create table t1 as select left(123,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lower(123));
+hex(lower(123))
+313233
+create table t1 as select lower(123) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(lpad(1,2,0));
+hex(lpad(1,2,0))
+3031
+create table t1 as select lpad(1,2,0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ltrim(1));
+hex(ltrim(1))
+31
+create table t1 as select ltrim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(mid(1,1,1));
+hex(mid(1,1,1))
+31
+create table t1 as select mid(1,1,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(repeat(1,2));
+hex(repeat(1,2))
+3131
+create table t1 as select repeat(1,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(replace(1,1,2));
+hex(replace(1,1,2))
+32
+create table t1 as select replace(1,1,2) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(reverse(12));
+hex(reverse(12))
+3231
+create table t1 as select reverse(12) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(right(123,1));
+hex(right(123,1))
+33
+create table t1 as select right(123,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rpad(1,2,0));
+hex(rpad(1,2,0))
+3130
+create table t1 as select rpad(1,2,0) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(rtrim(1));
+hex(rtrim(1))
+31
+create table t1 as select rtrim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(soundex(1));
+hex(soundex(1))
+
+create table t1 as select soundex(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(substring(1,1,1));
+hex(substring(1,1,1))
+31
+create table t1 as select substring(1,1,1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(trim(1));
+hex(trim(1))
+31
+create table t1 as select trim(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(ucase(1));
+hex(ucase(1))
+31
+create table t1 as select ucase(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+select hex(upper(1));
+hex(upper(1))
+31
+create table t1 as select upper(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select repeat(' ', 64) as a limit 0;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t1 values ("1.1"), ("2.1");
+select a, hex(a) from t1;
+a hex(a)
+1.1 312E31
+2.1 322E31
+update t1 set a= a + 0.1;
+select a, hex(a) from t1;
+a hex(a)
+1.2000000000000002 312E32303030303030303030303030303032
+2.2 322E32
+drop table t1;
+create table t1 (a tinyint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+303031 001
+303130 010
+313030 100
+drop table t1;
+create table t1 (a tinyint(4) zerofill);
+insert into t1 values (1), (10), (100);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303031 0001
+30303130 0010
+30313030 0100
+drop table t1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E3435
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(6) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303031 00001
+3030303130 00010
+3030313030 00100
+3031303030 01000
+3130303030 10000
+drop table t1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303030303031 00000001
+3030303030303130 00000010
+3030303030313030 00000100
+3030303031303030 00001000
+3030303130303030 00010000
+drop table t1;
+create table t1 (a int);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(11) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303030303030303031 0000000001
+30303030303030303130 0000000010
+30303030303030313030 0000000100
+30303030303031303030 0000001000
+30303030303130303030 0000010000
+drop table t1;
+create table t1 (a bigint);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+31
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(20) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+3030303030303030303030303030303030303031 00000000000000000001
+3030303030303030303030303030303030303130 00000000000000000010
+3030303030303030303030303030303030313030 00000000000000000100
+3030303030303030303030303030303031303030 00000000000000001000
+3030303030303030303030303030303130303030 00000000000000010000
+drop table t1;
+create table t1 (a float);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(12) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+303030303030303030312E31 0000000001.1
+303030303030303031302E31 0000000010.1
+303030303030303130302E31 0000000100.1
+303030303030313030302E31 0000001000.1
+303030303031303030302E31 0000010000.1
+drop table t1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3132332E343536
+select concat(a) from t1;
+concat(a)
+123.456
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(22) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+select hex(concat(a)), a from t1;
+hex(concat(a)) a
+30303030303030303030303030303030303030312E31 00000000000000000001.1
+30303030303030303030303030303030303031302E31 00000000000000000010.1
+30303030303030303030303030303030303130302E31 00000000000000000100.1
+30303030303030303030303030303030313030302E31 00000000000000001000.1
+30303030303030303030303030303031303030302E31 00000000000000010000.1
+drop table t1;
+create table t1 (a year(2));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+3031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(2) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a year);
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+32303031
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a bit(64));
+insert into t1 values (1);
+select hex(concat(a)) from t1;
+hex(concat(a))
+0000000000000001
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varbinary(64) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+select hex(concat(a)) from t1;
+hex(concat(a))
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+select concat(a) from t1;
+concat(a)
+0000-00-00 00:00:00
+2001-02-03 04:05:06
+1980-02-03 04:05:06
+2001-02-03 04:05:06
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(19) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D3033
+323030312D30322D3033
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(10) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+select hex(concat(a)) from t1;
+hex(concat(a))
+30303A30303A3031
+30313A30323A3033
+select concat(a) from t1;
+concat(a)
+00:00:01
+01:02:03
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(8) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+select hex(concat(a)) from t1;
+hex(concat(a))
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+create table t2 as select concat(a) from t1;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `concat(a)` varchar(19) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1, t2;
+create table t1 (a tinyint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(4) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a tinyint zerofill);
+insert into t1 values (1), (10), (100);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(3) YES NULL
+select hex(a) from v1;
+hex(a)
+303031
+303130
+313030
+drop table t1;
+drop view v1;
+create table t1 (a tinyint(30) zerofill);
+insert into t1 values (1), (10), (100);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(30) YES NULL
+select hex(a) from v1;
+hex(a)
+303030303030303030303030303030303030303030303030303030303031
+303030303030303030303030303030303030303030303030303030303130
+303030303030303030303030303030303030303030303030303030313030
+drop table t1;
+drop view v1;
+create table t1 (a decimal(10,2));
+insert into t1 values (123.45);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E3435
+drop table t1;
+drop view v1;
+create table t1 (a smallint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(6) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a smallint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(5) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303031
+3030303130
+3030313030
+3031303030
+3130303030
+drop table t1;
+drop view v1;
+create table t1 (a mediumint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(9) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a mediumint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(8) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303030303031
+3030303030303130
+3030303030313030
+3030303031303030
+3030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a int);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(11) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a int zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(10) YES NULL
+select hex(a) from v1;
+hex(a)
+30303030303030303031
+30303030303030303130
+30303030303030313030
+30303030303031303030
+30303030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a bigint);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(20) YES NULL
+select hex(a) from v1;
+hex(a)
+31
+drop table t1;
+drop view v1;
+create table t1 (a bigint zerofill);
+insert into t1 values (1), (10), (100), (1000), (10000);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(20) YES NULL
+select hex(a) from v1;
+hex(a)
+3030303030303030303030303030303030303031
+3030303030303030303030303030303030303130
+3030303030303030303030303030303030313030
+3030303030303030303030303030303031303030
+3030303030303030303030303030303130303030
+drop table t1;
+drop view v1;
+create table t1 (a float);
+insert into t1 values (123.456);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E343536
+drop table t1;
+drop view v1;
+create table t1 (a float zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(12) YES NULL
+select hex(a) from v1;
+hex(a)
+303030303030303030312E31
+303030303030303031302E31
+303030303030303130302E31
+303030303030313030302E31
+303030303031303030302E31
+drop table t1;
+drop view v1;
+create table t1 (a double);
+insert into t1 values (123.456);
+select concat(a) from t1;
+concat(a)
+123.456
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(22) YES NULL
+select hex(a) from v1;
+hex(a)
+3132332E343536
+drop table t1;
+drop view v1;
+create table t1 (a double zerofill);
+insert into t1 values (1.1), (10.1), (100.1), (1000.1), (10000.1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(22) YES NULL
+select hex(a) from v1;
+hex(a)
+30303030303030303030303030303030303030312E31
+30303030303030303030303030303030303031302E31
+30303030303030303030303030303030303130302E31
+30303030303030303030303030303030313030302E31
+30303030303030303030303030303031303030302E31
+drop table t1;
+drop view v1;
+create table t1 (a year(2));
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(2) YES NULL
+select hex(a) from v1;
+hex(a)
+3031
+drop table t1;
+drop view v1;
+create table t1 (a year);
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(4) YES NULL
+select hex(a) from v1;
+hex(a)
+32303031
+drop table t1;
+drop view v1;
+create table t1 (a bit(64));
+insert into t1 values (1);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varbinary(64) YES NULL
+select hex(a) from v1;
+hex(a)
+0000000000000001
+drop table t1;
+drop view v1;
+create table t1 (a timestamp);
+insert into t1 values (0);
+insert into t1 values (20010203040506);
+insert into t1 values (19800203040506);
+insert into t1 values ('2001-02-03 04:05:06');
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(19) NO
+select hex(a) from v1;
+hex(a)
+303030302D30302D30302030303A30303A3030
+323030312D30322D30332030343A30353A3036
+313938302D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+drop table t1;
+drop view v1;
+create table t1 (a date);
+insert into t1 values ('2001-02-03');
+insert into t1 values (20010203);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(10) YES NULL
+select hex(a) from v1;
+hex(a)
+323030312D30322D3033
+323030312D30322D3033
+drop table t1;
+drop view v1;
+create table t1 (a time);
+insert into t1 values (1);
+insert into t1 values ('01:02:03');
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(8) YES NULL
+select hex(a) from v1;
+hex(a)
+30303A30303A3031
+30313A30323A3033
+drop table t1;
+drop view v1;
+create table t1 (a datetime);
+insert into t1 values ('2001-02-03 04:05:06');
+insert into t1 values (20010203040506);
+create view v1(a) as select concat(a) from t1;
+show columns from v1;
+Field Type Null Key Default Extra
+a varchar(19) YES NULL
+select hex(a) from v1;
+hex(a)
+323030312D30322D30332030343A30353A3036
+323030312D30322D30332030343A30353A3036
+drop table t1;
+drop view v1;
+create function f1 (par1 int) returns int
+begin
+return concat(par1);
+end|
+set @a= f1(1);
+select hex(@a);
+hex(@a)
+1
+select hex(concat(f1(1)));
+hex(concat(f1(1)))
+31
+create table t1 as select f1(1) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(1)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(1)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(11) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 decimal(18,2)) returns decimal(18,2)
+begin
+return concat(par1);
+end|
+set @a= f1(123.45);
+select hex(@a);
+hex(@a)
+7B
+select hex(concat(f1(123.45)));
+hex(concat(f1(123.45)))
+3132332E3435
+create table t1 as select f1(123.45) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` decimal(18,2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(123.45)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(20) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(123.45)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(20) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 float) returns float
+begin
+return concat(par1);
+end|
+set @a= f1(123.45);
+select hex(@a);
+hex(@a)
+7B
+select hex(concat(f1(123.45)));
+hex(concat(f1(123.45)))
+3132332E3435
+create table t1 as select f1(123.45) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` float DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(123.45)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(12) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(123.45)) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(12) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+create function f1 (par1 date) returns date
+begin
+return concat(par1);
+end|
+set @a= f1(cast('2001-01-02' as date));
+select hex(@a);
+hex(@a)
+323030312D30312D3032
+select hex(concat(f1(cast('2001-01-02' as date))));
+hex(concat(f1(cast('2001-01-02' as date))))
+323030312D30312D3032
+create table t1 as select f1(cast('2001-01-02' as date)) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop table t1;
+create table t1 as select concat(f1(cast('2001-01-02' as date))) as c1;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `c1` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+create view v1 as select concat(f1(cast('2001-01-02' as date))) as c1;
+show columns from v1;
+Field Type Null Key Default Extra
+c1 varchar(10) YES NULL
+drop table t1;
+drop view v1;
+drop function f1;
+#
+# End of WL#2649 Number-to-string conversions
+#
+#
+# Bug#54668 User variable assignments get wrong type
+#
+SET @x=md5('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=old_password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=password('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=sha('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=sha1('a');
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=astext(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+SET @x=aswkt(point(1,2));
+SELECT charset(@x), collation(@x);
+charset(@x) collation(@x)
+utf8 utf8_general_ci
+#
+# Bug#54916 GROUP_CONCAT + IFNULL truncates output
+#
+SELECT @@collation_connection;
+@@collation_connection
+utf8_general_ci
+CREATE TABLE t1 (a MEDIUMINT NULL) ENGINE=MYISAM;
+INSERT INTO t1 VALUES (1234567);
+SELECT GROUP_CONCAT(IFNULL(a,'')) FROM t1;
+GROUP_CONCAT(IFNULL(a,''))
+1234567
+SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1;
+GROUP_CONCAT(IF(a,a,''))
+1234567
+SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1;
+GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END)
+1234567
+SELECT COALESCE(a,'') FROM t1 GROUP BY 1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(a,'') 253 27 7 Y 0 31 33
+COALESCE(a,'')
+1234567
+# All columns must be VARCHAR(9) with the same length:
+CREATE TABLE t2 AS
+SELECT
+CONCAT(a),
+IFNULL(a,''),
+IF(a,a,''),
+CASE WHEN a THEN a ELSE '' END,
+COALESCE(a,'')
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `IFNULL(a,'')` varchar(9) CHARACTER SET utf8 NOT NULL DEFAULT '',
+ `IF(a,a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `CASE WHEN a THEN a ELSE '' END` varchar(9) CHARACTER SET utf8 DEFAULT NULL,
+ `COALESCE(a,'')` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT CONCAT_WS(1,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `CONCAT_WS(1,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT INSERT(1133,3,0,22) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `INSERT(1133,3,0,22)` varchar(6) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT UCASE(a) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `UCASE(a)` varchar(9) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPEAT(1,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPEAT(1,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LEFT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LEFT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RIGHT(123,2) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RIGHT(123,2)` varchar(2) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT LTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `LTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT RTRIM(123) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `RTRIM(123)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT ELT(1,111,222,333) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `ELT(1,111,222,333)` varchar(3) CHARACTER SET utf8 DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT REPLACE(111,2,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `REPLACE(111,2,3)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SUBSTRING_INDEX(111,111,1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SUBSTRING_INDEX(111,111,1)` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT MAKE_SET(111,222,3) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MAKE_SET(111,222,3)` varchar(5) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT SOUNDEX(1) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `SOUNDEX(1)` varchar(4) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT EXPORT_SET(1,'Y','N','',8);
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `EXPORT_SET(1,'Y','N','',8)` varchar(64) CHARACTER SET utf8 NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of Bug#54916
+#
+#
+# Bug#52159 returning time type from function and empty left join causes debug assertion
+#
+CREATE FUNCTION f1() RETURNS TIME RETURN 1;
+CREATE TABLE t1 (b INT);
+INSERT INTO t1 VALUES (0);
+SELECT f1() FROM t1 LEFT JOIN (SELECT 1 AS a FROM t1 LIMIT 0) AS d ON 1 GROUP BY a;
+f1()
+00:00:01
+DROP FUNCTION f1;
+DROP TABLE t1;
+SET NAMES latin1;
+SET sql_mode='';
+CREATE TABLE t1(a char(215) CHARACTER SET utf8 NOT NULL DEFAULT '', KEY(a));
+INSERT INTO t1 VALUES ();
+SELECT maketime(`a`,`a`,`a`) FROM t1 GROUP BY 1;
+maketime(`a`,`a`,`a`)
+00:00:00
+DROP TABLE t1;
+SET sql_mode=default;
#
# End of 5.5 tests
#
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index 2bc77c52bec..4cb97719ff2 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -345,3 +345,80 @@ CREATE TABLE t1 LIKE t2;
ERROR 42S01: Table 't1' already exists
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug#54332 Deadlock with two connections doing LOCK TABLE+INSERT DELAYED
+#
+# This test is not supposed to work under --ps-protocol since
+# INSERT DELAYED doesn't work under LOCK TABLES with this protocol.
+DROP TABLE IF EXISTS t1, t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (a INT);
+CREATE TABLE t3 (a INT);
+# Test 1: Using LOCK TABLE
+# Connection con1
+LOCK TABLE t1 WRITE;
+# Connection default
+LOCK TABLE t2 WRITE;
+# Sending:
+INSERT DELAYED INTO t1 VALUES (1);
+# Connection con1
+# Wait until INSERT DELAYED is blocked on table 't1'.
+INSERT DELAYED INTO t2 VALUES (1);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+UNLOCK TABLES;
+# Connection default
+# Reaping: INSERT DELAYED INTO t1 VALUES (1)
+UNLOCK TABLES;
+# Test 2: Using ALTER TABLE
+START TRANSACTION;
+SELECT * FROM t1 WHERE a=0;
+a
+# Connection con1
+# Sending:
+ALTER TABLE t1 COMMENT 'test';
+# Connection default
+# Wait until ALTER TABLE is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (3);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: ALTER TABLE t1 COMMENT 'test'
+# Test 3: Using RENAME TABLE
+# Connection default
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+# Connection con1
+# Sending:
+RENAME TABLE t1 to t5, t2 to t4;
+# Connection default
+# Wait until RENAME TABLE is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (4);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con1
+# Reaping: RENAME TABLE t1 to t5, t2 to t4
+# Connection default
+# Reverting the renames
+RENAME TABLE t5 to t1, t4 to t2;
+# Test 4: Two INSERT DELAYED on the same table
+START TRANSACTION;
+INSERT INTO t2 VALUES (1);
+# Connection con2
+LOCK TABLE t1 WRITE, t2 WRITE;
+# Connection con1
+# Wait until LOCK TABLE is blocked on table 't2'.
+INSERT DELAYED INTO t1 VALUES (5);
+# Connection default
+# Wait until INSERT DELAYED is blocked on table 't1'.
+INSERT DELAYED INTO t1 VALUES (6);
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+COMMIT;
+# Connection con2
+# Reaping: LOCK TABLE t1 WRITE, t2 WRITE
+UNLOCK TABLES;
+# Connection con1
+# Reaping: INSERT DELAYED INTO t1 VALUES (5)
+# Connection con2
+# Connection con1
+# Connection default
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/r/endspace.result b/mysql-test/r/endspace.result
index 9c8d12362c4..4eca88774b4 100644
--- a/mysql-test/r/endspace.result
+++ b/mysql-test/r/endspace.result
@@ -54,8 +54,8 @@ text1 like 'teststring_%' ORDER BY text1;
text1
teststring
teststring
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
@@ -105,11 +105,11 @@ select concat('|', text1, '|') from t1 where text1 like 'teststring_%';
concat('|', text1, '|')
|teststring |
|teststring |
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
-|teststring|
|teststring |
+|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 > 'teststring\t';
concat('|', text1, '|')
|teststring|
@@ -123,8 +123,8 @@ concat('|', text1, '|')
drop table t1;
create table t1 (text1 varchar(32) not NULL, KEY key1 (text1)) pack_keys=0;
insert into t1 values ('teststring'), ('nothing'), ('teststring\t');
-select concat('|', text1, '|') from t1 where text1='teststring' or text1 like 'teststring_%';
-concat('|', text1, '|')
+select concat('|', text1, '|') as c from t1 where text1='teststring' or text1 like 'teststring_%' order by c;
+c
|teststring |
|teststring|
select concat('|', text1, '|') from t1 where text1='teststring' or text1 >= 'teststring\t';
@@ -203,13 +203,13 @@ teststring
teststring
select text1, length(text1) from t1 where text1='teststring' or text1 like 'teststring_%';
text1 length(text1)
-teststring 11
teststring 10
+teststring 11
teststring 11
select text1, length(text1) from t1 where text1='teststring' or text1 >= 'teststring\t';
text1 length(text1)
-teststring 11
teststring 10
+teststring 11
teststring 11
select concat('|', text1, '|') from t1 order by text1;
concat('|', text1, '|')
diff --git a/mysql-test/r/events_trans.result b/mysql-test/r/events_trans.result
index 16ec64b4c50..37951c30787 100644
--- a/mysql-test/r/events_trans.result
+++ b/mysql-test/r/events_trans.result
@@ -116,3 +116,22 @@ OK: create event: database does not exist
delete from t1;
commit work;
drop database events_test;
+#
+# Bug#54105 assert in MDL_context::release_locks_stored_before
+#
+USE test;
+DROP TABLE IF EXISTS t1, t2;
+DROP EVENT IF EXISTS e1;
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT);
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1;
+START TRANSACTION;
+INSERT INTO t1 VALUES (1);
+SAVEPOINT A;
+SHOW CREATE EVENT e1;
+Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
+e1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `e1` ON SCHEDULE EVERY 1 DAY STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT * FROM t2;
+a
+ROLLBACK WORK TO SAVEPOINT A;
+DROP TABLE t1, t2;
diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result
index 3702443d04a..aee18d91edf 100644
--- a/mysql-test/r/flush.result
+++ b/mysql-test/r/flush.result
@@ -205,6 +205,51 @@ a
insert into t2 (a) values (3);
# --> connection default;
unlock tables;
+#
+# Check that "FLUSH TABLES <list> WITH READ LOCK" is
+# compatible with active "FLUSH TABLES WITH READ LOCK".
+# Vice versa it is not true, since tables read-locked by
+# "FLUSH TABLES <list> WITH READ LOCK" can't be flushed.
+flush tables with read lock;
+# --> connection con1;
+flush table t1 with read lock;
+select * from t1;
+a
+1
+unlock tables;
+# --> connection default;
+unlock tables;
+#
+# Check that FLUSH TABLES t1 WITH READ LOCK
+# does not conflict with an existing FLUSH TABLES t2
+# WITH READ LOCK.
+#
+flush table t1 with read lock;
+# --> connection con1
+flush table t2 with read lock;
+unlock tables;
+# --> connection default
+unlock tables;
+#
+# Check that FLUSH TABLES t1 WITH READ LOCK
+# does not conflict with SET GLOBAL read_only=1.
+#
+set global read_only=1;
+# connection con1
+flush table t1 with read lock;
+unlock tables;
+# connection default
+set global read_only=0;
+#
+# Check that it's possible to read-lock
+# tables locked with FLUSH TABLE <list> WITH READ LOCK.
+#
+flush tables t1, t2 with read lock;
+# connection con1
+lock table t1 read, t2 read;
+unlock tables;
+# connection default
+unlock tables;
# --> connection con1
drop table t1, t2, t3;
#
@@ -234,3 +279,97 @@ drop temporary table v1;
unlock tables;
drop view v2, v3;
drop table t1, v1;
+#
+# FLUSH TABLES <list> WITH READ LOCK and HANDLER
+#
+drop table if exists t1;
+create table t1 (a int, key a (a));
+insert into t1 (a) values (1), (2), (3);
+handler t1 open;
+handler t1 read a next;
+a
+1
+handler t1 read a next;
+a
+2
+flush tables t1 with read lock;
+handler t1 read a next;
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+unlock tables;
+#
+# Sic: lost handler position.
+#
+handler t1 read a next;
+a
+1
+handler t1 close;
+drop table t1;
+#
+# Bug#52117 Pending FLUSH TALBES <list> aborts
+# transactions unnecessarily.
+#
+drop table if exists t1;
+# --> conection default
+create table t1 (a int);
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ. We could use HANDLER t1 OPEN
+# or a long-running select -- anything that
+# prevents FLUSH TABLE t1 from immediate completion would do.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLE expels the table definition from the cache.
+# Sending 'flush table t1'...
+flush table t1;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush table t1'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+#
+# Repeat the same test but with FLUSH TABLES
+#
+begin;
+select * from t1;
+a
+# --> connection con1
+#
+# Issue a LOCK TABLE t1 READ.
+#
+lock table t1 read;
+# --> connection con2
+#
+# FLUSH TABLES expels the table definition from the cache.
+# Sending 'flush tables'...
+flush tables;
+# --> connection default
+# Let flush table sync in.
+select * from t1;
+# --> connection con1
+select * from t1;
+a
+unlock tables;
+# --> connection con2
+# Reaping 'flush tables'...
+# --> connection default
+# Reaping 'select * from t1'...
+a
+commit;
+# Cleanup
+# --> connection con1
+# --> connection con2
+# --> connection default
+drop table t1;
diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result
index 1a393b3cdd5..302de9de9f7 100644
--- a/mysql-test/r/func_gconcat.result
+++ b/mysql-test/r/func_gconcat.result
@@ -1003,6 +1003,7 @@ SELECT 1 FROM
1
1
DROP TABLE t1;
+End of 5.0 tests
#
# Bug #52397: another crash with explain extended and group_concat
#
@@ -1019,6 +1020,25 @@ Warnings:
Note 1003 select 1 AS `1` from dual
DROP TABLE t1;
End of 5.0 tests
+#
+# Bug #54476: crash when group_concat and 'with rollup' in prepared statements
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+PREPARE stmt FROM "SELECT GROUP_CONCAT(t1.a ORDER BY t1.a) FROM t1 JOIN t1 t2 GROUP BY t1.a WITH ROLLUP";
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+EXECUTE stmt;
+GROUP_CONCAT(t1.a ORDER BY t1.a)
+1,1
+2,2
+1,1,2,2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+End of 5.1 tests
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (a VARCHAR(6), b INT);
CREATE TABLE t2 (a VARCHAR(6), b INT);
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result
index 45c93971852..5f874f4665d 100644
--- a/mysql-test/r/func_group.result
+++ b/mysql-test/r/func_group.result
@@ -1713,9 +1713,20 @@ f1 f2 f3 f4 f1 = f2
NULL NULL NULL NULL NULL
drop table t1;
#
+# Bug #54465: assert: field_types == 0 || field_types[field_pos] ==
+# MYSQL_TYPE_LONGLONG
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT MAX((SELECT 1 FROM t1 ORDER BY @var LIMIT 1)) m FROM t1 t2, t1
+ORDER BY t1.a;
+m
+1
+DROP TABLE t1;
+#
End of 5.1 tests
#
-# Bug#55648: Server crash on MIX/MAX on maximum time value
+# Bug#55648: Server crash on MIN/MAX on maximum time value
#
CREATE TABLE t1(c1 TIME NOT NULL);
INSERT INTO t1 VALUES('837:59:59');
@@ -1725,3 +1736,13 @@ MAX(c1)
838:59:59
DROP TABLE t1;
# End of the bug#55648
+#
+# Bug#56120: Failed assertion on MIN/MAX on negative time value
+#
+CREATE TABLE t1(c1 TIME NOT NULL);
+INSERT INTO t1 VALUES('-00:00:01');
+SELECT MAX(c1),MIN(c1) FROM t1;
+MAX(c1) MIN(c1)
+-00:00:01 -00:00:01
+DROP TABLE t1;
+# End of the bug#56120
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index e21e7903459..1eb4153eb8b 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -337,6 +337,21 @@ select connection_id() > 0;
connection_id() > 0
1
#
+# Bug #54461: crash with longblob and union or update with subquery
+#
+CREATE TABLE t1 (a INT, b LONGBLOB);
+INSERT INTO t1 VALUES (1, '2'), (2, '3'), (3, '2');
+SELECT DISTINCT LEAST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+LEAST(a, (SELECT b FROM t1 LIMIT 1))
+1
+2
+SELECT DISTINCT GREATEST(a, (SELECT b FROM t1 LIMIT 1)) FROM t1 UNION SELECT 1;
+GREATEST(a, (SELECT b FROM t1 LIMIT 1))
+2
+3
+1
+DROP TABLE t1;
+#
# Bug #52165: Assertion failed: file .\dtoa.c, line 465
#
CREATE TABLE t1 (a SET('a'), b INT);
diff --git a/mysql-test/r/func_str.result b/mysql-test/r/func_str.result
index 7539cf43dd9..f01d46a9f41 100644
--- a/mysql-test/r/func_str.result
+++ b/mysql-test/r/func_str.result
@@ -2734,3 +2734,28 @@ format(123, 1, 'Non-existent-locale')
Warnings:
Warning 1649 Unknown locale: 'Non-existent-locale'
End of 5.4 tests
+#
+# Start of 5.5 tests
+#
+#
+# Bug#55912 FORMAT with locale set fails for numbers < 1000
+#
+SELECT FORMAT(123.33, 2, 'no_NO'), FORMAT(1123.33, 2, 'no_NO');
+FORMAT(123.33, 2, 'no_NO') FORMAT(1123.33, 2, 'no_NO')
+123,33 1.123,33
+SELECT FORMAT(12333e-2, 2, 'no_NO'), FORMAT(112333e-2, 2, 'no_NO');
+FORMAT(12333e-2, 2, 'no_NO') FORMAT(112333e-2, 2, 'no_NO')
+123,33 1.123,33
+CREATE TABLE t1 AS SELECT format(123,2,'no_NO');
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `format(123,2,'no_NO')` varchar(37) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+format(123,2,'no_NO')
+123,00
+DROP TABLE t1;
+#
+# End of 5.5 tests
+#
diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result
index c3f210edee5..9ba1ae489ca 100644
--- a/mysql-test/r/func_time.result
+++ b/mysql-test/r/func_time.result
@@ -1305,4 +1305,12 @@ date_sub("0069-01-01 00:00:01",INTERVAL 2 SECOND)
select date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND);
date_sub("0169-01-01 00:00:01",INTERVAL 2 SECOND)
0168-12-31 23:59:59
+CREATE TABLE t1(a DOUBLE NOT NULL);
+INSERT INTO t1 VALUES (0),(9.216e-096);
+# should not crash
+SELECT 1 FROM t1 ORDER BY @x:=makedate(a,a);
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/handler_read_last.result b/mysql-test/r/handler_read_last.result
new file mode 100644
index 00000000000..a21e9ed9564
--- /dev/null
+++ b/mysql-test/r/handler_read_last.result
@@ -0,0 +1,60 @@
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT, INDEX (a));
+INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),();
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 1;
+a
+NULL
+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
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 1;
+a
+NULL
+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 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a LIMIT 3;
+a
+NULL
+NULL
+NULL
+SHOW STATUS LIKE 'HANDLER_READ%';
+Variable_name Value
+Handler_read_first 1
+Handler_read_key 0
+Handler_read_last 0
+Handler_read_next 2
+Handler_read_prev 0
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+FLUSH STATUS;
+SELECT a FROM t1 ORDER BY a DESC LIMIT 3;
+a
+NULL
+NULL
+NULL
+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 2
+Handler_read_rnd 0
+Handler_read_rnd_next 0
+DROP TABLE t1;
diff --git a/mysql-test/r/information_schema_inno.result b/mysql-test/r/information_schema_inno.result
index fbb7e7e8397..838a7ad5162 100644
--- a/mysql-test/r/information_schema_inno.result
+++ b/mysql-test/r/information_schema_inno.result
@@ -89,3 +89,15 @@ UNIQUE_CONSTRAINT_NAME
NULL
drop table t2;
set foreign_key_checks = 1;
+#
+# Bug#55973 Assertion `thd->transaction.stmt.is_empty()'
+# on CREATE TABLE .. SELECT I_S.PART
+#
+DROP TABLE IF EXISTS t1;
+DROP VIEW IF EXISTS v1;
+CREATE VIEW v1 AS SELECT 1;
+CREATE TABLE t1 engine = InnoDB AS
+SELECT * FROM information_schema.partitions
+WHERE table_schema= 'test' AND table_name= 'v1';
+DROP TABLE t1;
+DROP VIEW v1;
diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result
index f12c9a0a61a..b0858894b71 100644
--- a/mysql-test/r/insert_select.result
+++ b/mysql-test/r/insert_select.result
@@ -694,6 +694,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
diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result
index 9f87ea082db..260f7170fc5 100644
--- a/mysql-test/r/join.result
+++ b/mysql-test/r/join.result
@@ -854,6 +854,7 @@ 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 0
diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result
index 847a00cad94..0af32d8f749 100644
--- a/mysql-test/r/join_outer.result
+++ b/mysql-test/r/join_outer.result
@@ -1238,6 +1238,7 @@ show status like 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 5
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/locale.result b/mysql-test/r/locale.result
index b52ed8070f9..aa61d8cd86f 100644
--- a/mysql-test/r/locale.result
+++ b/mysql-test/r/locale.result
@@ -44,7 +44,7 @@ a abmon mon
2006-12-01 Δεκ Δεκέμβριος
SELECT format(123456.789, 3, 'el_GR');
format(123456.789, 3, 'el_GR')
-123456.789
+123456,789
DROP TABLE t1;
#
# Bug#46633 Obsolete Serbian locale name
diff --git a/mysql-test/r/mdl_sync.result b/mysql-test/r/mdl_sync.result
index 0fd408b0208..d484ab77701 100644
--- a/mysql-test/r/mdl_sync.result
+++ b/mysql-test/r/mdl_sync.result
@@ -2034,6 +2034,155 @@ set debug_sync='now SIGNAL go2';
# Switching to connection 'default'.
# Reaping ALTER. It should succeed and not produce ER_LOCK_DEADLOCK.
drop table t1;
+#
+# Now, test for a situation in which deadlock involves waiting not
+# only in MDL subsystem but also for TDC. Such deadlocks should be
+# successfully detected. If possible, they should be resolved without
+# resorting to ER_LOCK_DEADLOCK error.
+#
+create table t1(i int);
+create table t2(j int);
+#
+# First, let us check how we handle a simple scenario involving
+# waits in MDL and TDC.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con1'.
+# Start a statement, which will acquire SR metadata lock on t1, open it
+# and then stop, before trying to acquire SW lock on t2 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# Sending:
+select * from t1 where i in (select j from t2 for update);
+# Switching to connection 'deadlock_con2'.
+# Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t1 and t2 and wait till SELECT closes t1.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'deadlock_con3'.
+# Wait until FLUSH TABLES WITH t1, t2 READ LOCK starts waiting
+# for SELECT to close t1.
+# Resume SELECT, so it tries to acquire SW lock on t1 and blocks,
+# creating a deadlock. This deadlock should be detected and resolved
+# by backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+unlock tables;
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT.
+i
+#
+# The same scenario with a slightly different order of events
+# which emphasizes that setting correct deadlock detector weights
+# for flush waits is important.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con2'.
+set debug_sync='flush_tables_with_read_lock_after_acquire_locks SIGNAL parked WAIT_FOR go';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t1 and t2 and wait on debug sync point.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'deadlock_con1'.
+# Wait till FLUSH TABLE WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+# Start statement which will acquire SR metadata lock on t1, open
+# it and then will block while trying to acquire SW lock on t2.
+# Sending:
+select * from t1 where i in (select j from t2 for update);
+# Switching to connection 'deadlock_con3'.
+# Wait till the above SELECT blocks.
+# Resume FLUSH TABLES, so it tries to flush t1, thus creating
+# a deadlock. This deadlock should be detected and resolved by
+# backing-off SELECT. As a result FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+unlock tables;
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT.
+i
+#
+# Now a more complex scenario involving two connections
+# waiting for MDL and one for TDC.
+#
+set debug_sync= 'RESET';
+# Switching to connection 'deadlock_con1'.
+# Start a statement which will acquire SR metadata lock on t2, open it
+# and then stop, before trying to acquire SR on t1 and opening it.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# Sending:
+select * from t2, t1;
+# Switching to connection 'deadlock_con2'.
+# Wait till the above SELECT stops.
+set debug_sync='now WAIT_FOR parked';
+# The below FLUSH TABLES WITH READ LOCK should acquire
+# SNW locks on t2 and wait till SELECT closes t2.
+# Sending:
+flush tables t2 with read lock;
+# Switching to connection 'deadlock_con3'.
+# Wait until FLUSH TABLES WITH READ LOCK starts waiting
+# for SELECT to close t2.
+# The below DROP TABLES should acquire X lock on t1 and start
+# waiting for X lock on t2.
+# Sending:
+drop tables t1, t2;
+# Switching to connection 'default'.
+# Wait until DROP TABLES starts waiting for X lock on t2.
+# Resume SELECT, so it tries to acquire SR lock on t1 and blocks,
+# creating a deadlock. This deadlock should be detected and resolved
+# by backing-off SELECT. As a result, FTWRL should be able to finish.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'deadlock_con2'.
+# Reap FLUSH TABLES WITH READ LOCK.
+# Unblock DROP TABLES.
+unlock tables;
+# Switching to connection 'deadlock_con3'.
+# Reap DROP TABLES.
+# Switching to connection 'deadlock_con1'.
+# Reap SELECT. It should emit error about missing table.
+ERROR 42S02: Table 'test.t2' doesn't exist
+# Switching to connection 'default'.
+set debug_sync= 'RESET';
+#
+# Test for a scenario in which FLUSH TABLES <list> WITH READ LOCK
+# used to erroneously release metadata locks.
+#
+drop tables if exists t1, t2;
+set debug_sync= 'RESET';
+create table t1(i int);
+create table t2(j int);
+# Switching to connection 'con2'.
+set debug_sync='open_tables_after_open_and_process_table SIGNAL parked WAIT_FOR go';
+# The below FLUSH TABLES <list> WITH READ LOCK should acquire
+# SNW locks on t1 and t2, open table t1 and block on the debug
+# sync point.
+# Sending:
+flush tables t1, t2 with read lock;
+# Switching to connection 'con1'.
+# Wait till FLUSH TABLES <list> WITH READ LOCK stops.
+set debug_sync='now WAIT_FOR parked';
+# Start a statement which will flush all tables and thus
+# invalidate table t1 open by FLUSH TABLES <list> WITH READ LOCK.
+# Sending:
+flush tables;
+# Switching to connection 'default'.
+# Wait till the above FLUSH TABLES blocks.
+# Resume FLUSH TABLES <list> WITH READ LOCK, so it tries to open t2
+# discovers that its t1 is obsolete and tries to reopen all tables.
+# Such reopen should not cause releasing of SNW metadata locks
+# which would result in assertion failures.
+set debug_sync='now SIGNAL go';
+# Switching to connection 'con2'.
+# Reap FLUSH TABLES <list> WITH READ LOCK.
+unlock tables;
+# Switching to connection 'con1'.
+# Reap FLUSH TABLES.
+# Clean-up.
+# Switching to connection 'default'.
+drop tables t1, t2;
set debug_sync= 'RESET';
#
# Test for bug #46748 "Assertion in MDL_context::wait_for_locks()
diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result
index f7f0cea3b19..c7e54288f8b 100644
--- a/mysql-test/r/merge.result
+++ b/mysql-test/r/merge.result
@@ -933,7 +933,8 @@ DROP TABLE tm1, t1, t2;
CREATE TABLE t1(c1 INT);
CREATE TABLE t2 (c1 INT) ENGINE=MERGE UNION=(t1) INSERT_METHOD=FIRST;
CREATE TABLE IF NOT EXISTS t1 SELECT * FROM t2;
-ERROR HY000: You can't specify target table 't1' for update in FROM clause
+Warnings:
+Note 1050 Table 't1' already exists
DROP TABLE t1, t2;
CREATE TABLE t1 (id INT NOT NULL, ref INT NOT NULL, INDEX (id)) ENGINE=MyISAM;
CREATE TABLE t2 LIKE t1;
diff --git a/mysql-test/r/mysql_not_windows.result b/mysql-test/r/mysql_not_windows.result
new file mode 100644
index 00000000000..d5670a1a9ca
--- /dev/null
+++ b/mysql-test/r/mysql_not_windows.result
@@ -0,0 +1,5 @@
+Bug #54466 client 5.5 built from source lacks "pager" support
+a
+1
+
+End of tests
diff --git a/mysql-test/r/mysqlbinlog.result b/mysql-test/r/mysqlbinlog.result
index e728eb8244d..51fad679909 100644
--- a/mysql-test/r/mysqlbinlog.result
+++ b/mysql-test/r/mysqlbinlog.result
@@ -28,7 +28,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))
@@ -229,7 +229,7 @@ SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
-drop table if exists t1,t2,t3,t4,t5,t03,t04
+DROP TABLE IF EXISTS `t1`,`t2`,`t3`,`t4`,`t5`,`t03`,`t04` /* generated by server */
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
create table t1 (word varchar(20))
@@ -628,7 +628,7 @@ SET TIMESTAMP=1000000000/*!*/;
COMMIT
/*!*/;
SET TIMESTAMP=1000000000/*!*/;
-drop table t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
DELIMITER ;
# End of log file
diff --git a/mysql-test/r/mysqlbinlog_row.result b/mysql-test/r/mysqlbinlog_row.result
index 85416138c6d..7ae1ea36899 100644
--- a/mysql-test/r/mysqlbinlog_row.result
+++ b/mysql-test/r/mysqlbinlog_row.result
@@ -385,7 +385,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -567,7 +567,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -595,7 +595,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -673,7 +673,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -759,7 +759,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -806,7 +806,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -850,7 +850,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -894,7 +894,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -960,7 +960,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1004,7 +1004,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1070,7 +1070,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1114,7 +1114,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1180,7 +1180,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1224,7 +1224,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1290,7 +1290,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1334,7 +1334,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1378,7 +1378,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1439,7 +1439,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1483,7 +1483,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1527,7 +1527,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1572,7 +1572,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1616,7 +1616,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1660,7 +1660,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1704,7 +1704,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1748,7 +1748,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1792,7 +1792,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1836,7 +1836,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1880,7 +1880,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1924,7 +1924,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -1968,7 +1968,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2032,7 +2032,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2076,7 +2076,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2120,7 +2120,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2164,7 +2164,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2230,7 +2230,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2274,7 +2274,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2318,7 +2318,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2362,7 +2362,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2406,7 +2406,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2450,7 +2450,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2494,7 +2494,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2558,7 +2558,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2622,7 +2622,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2666,7 +2666,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2710,7 +2710,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2754,7 +2754,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2798,7 +2798,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2876,7 +2876,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2920,7 +2920,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -2998,7 +2998,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3076,7 +3076,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3120,7 +3120,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3198,7 +3198,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3276,7 +3276,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3320,7 +3320,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3364,7 +3364,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3408,7 +3408,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3452,7 +3452,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3496,7 +3496,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3540,7 +3540,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3584,7 +3584,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3628,7 +3628,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3672,7 +3672,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3716,7 +3716,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3760,7 +3760,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3804,7 +3804,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3848,7 +3848,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -3994,7 +3994,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1
+DROP TABLE `t1` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
@@ -4127,7 +4127,7 @@ COMMIT
# at #
#010909 4:46:40 server id 1 end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
-DROP TABLE t1,t2
+DROP TABLE `t1`,`t2` /* generated by server */
/*!*/;
# at #
#010909 4:46:40 server id 1 end_log_pos # Rotate to master-bin.000002 pos: 4
diff --git a/mysql-test/r/mysqld--help-notwin.result b/mysql-test/r/mysqld--help-notwin.result
index bc67a448f77..025f67082ec 100644
--- a/mysql-test/r/mysqld--help-notwin.result
+++ b/mysql-test/r/mysqld--help-notwin.result
@@ -860,9 +860,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/mysqld--help-win.result b/mysql-test/r/mysqld--help-win.result
index 7eee15913f4..e1098b71e25 100644
--- a/mysql-test/r/mysqld--help-win.result
+++ b/mysql-test/r/mysqld--help-win.result
@@ -864,9 +864,9 @@ performance-schema-max-file-classes 50
performance-schema-max-file-handles 32768
performance-schema-max-file-instances 10000
performance-schema-max-mutex-classes 200
-performance-schema-max-mutex-instances 1000
-performance-schema-max-rwlock-classes 20
-performance-schema-max-rwlock-instances 1000
+performance-schema-max-mutex-instances 1000000
+performance-schema-max-rwlock-classes 30
+performance-schema-max-rwlock-instances 1000000
performance-schema-max-table-handles 100000
performance-schema-max-table-instances 50000
performance-schema-max-thread-classes 50
diff --git a/mysql-test/r/not_partition.result b/mysql-test/r/not_partition.result
index fc3e0d64b5e..2c48f56d578 100644
--- a/mysql-test/r/not_partition.result
+++ b/mysql-test/r/not_partition.result
@@ -21,23 +21,17 @@ Table Op Msg_type Msg_text
test.t1 repair Error Unknown storage engine 'partition'
test.t1 repair error Corrupt
ALTER TABLE t1 REPAIR PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 repair Error Unknown storage engine 'partition'
-test.t1 repair error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 CHECK PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 check Error Unknown storage engine 'partition'
-test.t1 check error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 OPTIMIZE PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 optimize Error Unknown storage engine 'partition'
-test.t1 optimize error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ANALYZE PARTITION ALL;
-Table Op Msg_type Msg_text
-test.t1 analyze Error Unknown storage engine 'partition'
-test.t1 analyze error Corrupt
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 REBUILD PARTITION ALL;
ERROR 42000: Unknown storage engine 'partition'
+ALTER TABLE t1 TRUNCATE PARTITION ALL;
+ERROR HY000: The 'partitioning' feature is disabled; you need MySQL built with '--with-plugin-partition' to have it working
ALTER TABLE t1 ENGINE Memory;
ERROR 42000: Unknown storage engine 'partition'
ALTER TABLE t1 ADD (new INT);
diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result
index 58c587fe588..fd523168e7c 100644
--- a/mysql-test/r/null_key.result
+++ b/mysql-test/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/r/partition.result b/mysql-test/r/partition.result
index 55366bd2e07..dfcd9dde73d 100644
--- a/mysql-test/r/partition.result
+++ b/mysql-test/r/partition.result
@@ -359,6 +359,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -377,6 +378,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -407,6 +409,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -423,6 +426,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -439,6 +443,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
@@ -455,6 +460,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 2
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/partition_disabled.result b/mysql-test/r/partition_disabled.result
index df36f56a328..507c6ebe9e9 100644
--- a/mysql-test/r/partition_disabled.result
+++ b/mysql-test/r/partition_disabled.result
@@ -3,7 +3,7 @@ FLUSH TABLES;
SELECT * FROM t1;
ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
TRUNCATE TABLE t1;
-ERROR HY000: The MySQL server is running with the --skip-partition option so it cannot execute this statement
+ERROR 42S02: Table 'test.t1' doesn't exist
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze Error The MySQL server is running with the --skip-partition option so it cannot execute this statement
diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
index 58d014938bf..93cb1617d2f 100644
--- a/mysql-test/r/partition_innodb.result
+++ b/mysql-test/r/partition_innodb.result
@@ -1,5 +1,103 @@
drop table if exists t1, t2;
#
+# Bug#54747: Deadlock between REORGANIZE PARTITION and
+# SELECT is not detected
+#
+SET @old_innodb_thread_concurrency:= @@innodb_thread_concurrency;
+SET GLOBAL innodb_thread_concurrency = 1;
+CREATE TABLE t1
+(user_num BIGINT,
+hours SMALLINT,
+KEY user_num (user_num))
+ENGINE = InnoDB
+PARTITION BY RANGE COLUMNS (hours)
+(PARTITION hour_003 VALUES LESS THAN (3),
+PARTITION hour_004 VALUES LESS THAN (4),
+PARTITION hour_005 VALUES LESS THAN (5),
+PARTITION hour_last VALUES LESS THAN (MAXVALUE));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3), (4, 4), (5, 5);
+BEGIN;
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+# con1
+# SEND a ALTER PARTITION which waits on the ongoing transaction.
+ALTER TABLE t1
+REORGANIZE PARTITION hour_003, hour_004 INTO
+(PARTITION oldest VALUES LESS THAN (4));
+# Connection default wait until the ALTER is in 'waiting for table...'
+# state and then continue the transaction by trying a SELECT
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+5
+COMMIT;
+# con1, reaping ALTER.
+# Disconnecting con1 and switching to default. Cleaning up.
+SET GLOBAL innodb_thread_concurrency = @old_innodb_thread_concurrency;
+DROP TABLE t1;
+#
+# Bug#50418: DROP PARTITION does not interact with transactions
+#
+CREATE TABLE t1 (
+id INT AUTO_INCREMENT NOT NULL,
+name CHAR(50) NOT NULL,
+myDate DATE NOT NULL,
+PRIMARY KEY (id, myDate),
+INDEX idx_date (myDate)
+) ENGINE=InnoDB
+PARTITION BY RANGE ( TO_DAYS(myDate) ) (
+PARTITION p0 VALUES LESS THAN (734028),
+PARTITION p1 VALUES LESS THAN (734029),
+PARTITION p2 VALUES LESS THAN (734030),
+PARTITION p3 VALUES LESS THAN MAXVALUE
+) ;
+INSERT INTO t1 VALUES
+(NULL, 'Lachlan', '2009-09-13'),
+(NULL, 'Clint', '2009-09-13'),
+(NULL, 'John', '2009-09-14'),
+(NULL, 'Dave', '2009-09-14'),
+(NULL, 'Jeremy', '2009-09-15'),
+(NULL, 'Scott', '2009-09-15'),
+(NULL, 'Jeff', '2009-09-16'),
+(NULL, 'Joe', '2009-09-16');
+SET AUTOCOMMIT=0;
+SELECT * FROM t1 FOR UPDATE;
+id name myDate
+1 Lachlan 2009-09-13
+2 Clint 2009-09-13
+3 John 2009-09-14
+4 Dave 2009-09-14
+5 Jeremy 2009-09-15
+6 Scott 2009-09-15
+7 Jeff 2009-09-16
+8 Joe 2009-09-16
+UPDATE t1 SET name = 'Mattias' WHERE id = 7;
+SELECT * FROM t1 WHERE id = 7;
+id name myDate
+7 Mattias 2009-09-16
+# Connection con1
+SET lock_wait_timeout = 1;
+# After the patch it will wait and fail on timeout.
+ALTER TABLE t1 DROP PARTITION p3;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+SHOW WARNINGS;
+Level Code Message
+Error 1205 Lock wait timeout exceeded; try restarting transaction
+# Connection default
+SELECT * FROM t1;
+id name myDate
+1 Lachlan 2009-09-13
+2 Clint 2009-09-13
+3 John 2009-09-14
+4 Dave 2009-09-14
+5 Jeremy 2009-09-15
+6 Scott 2009-09-15
+7 Mattias 2009-09-16
+8 Joe 2009-09-16
+# No changes.
+COMMIT;
+DROP TABLE t1;
+#
# Bug#51830: Incorrect partition pruning on range partition (regression)
#
CREATE TABLE t1 (a INT NOT NULL)
diff --git a/mysql-test/r/partition_not_blackhole.result b/mysql-test/r/partition_not_blackhole.result
new file mode 100644
index 00000000000..dc0339f8c48
--- /dev/null
+++ b/mysql-test/r/partition_not_blackhole.result
@@ -0,0 +1,16 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#46086: crash when dropping a partitioned table and
+# the original engine is disabled
+# Copy a .frm and .par file which was created with:
+# create table `t1` (`id` int primary key) engine=blackhole
+# partition by key () partitions 1;
+SHOW TABLES;
+Tables_in_test
+t1
+SHOW CREATE TABLE t1;
+ERROR HY000: Incorrect information in file: './test/t1.frm'
+DROP TABLE t1;
+ERROR 42S02: Unknown table 't1'
+t1.frm
+t1.par
diff --git a/mysql-test/r/partition_truncate.result b/mysql-test/r/partition_truncate.result
index 8f594a319df..66c0cd3d9da 100644
--- a/mysql-test/r/partition_truncate.result
+++ b/mysql-test/r/partition_truncate.result
@@ -16,3 +16,11 @@ subpartitions 1
alter table t1 truncate partition sp1;
ERROR HY000: Incorrect partition name
drop table t1;
+create table t1 (a int);
+insert into t1 values (1), (3), (8);
+alter table t1 truncate partition p0;
+ERROR HY000: Partition management on a not partitioned table is not possible
+select count(*) from t1;
+count(*)
+3
+drop table t1;
diff --git a/mysql-test/r/ps_ddl.result b/mysql-test/r/ps_ddl.result
index 9752c5160a6..76d6c735f43 100644
--- a/mysql-test/r/ps_ddl.result
+++ b/mysql-test/r/ps_ddl.result
@@ -1833,7 +1833,6 @@ SUCCESS
select * from t2;
a
1
-1
execute stmt;
Warnings:
Note 1050 Table 't2' already exists
@@ -1843,8 +1842,6 @@ SUCCESS
select * from t2;
a
1
-1
-1
drop table t2;
create temporary table t2 (a varchar(10));
execute stmt;
@@ -1852,7 +1849,6 @@ Warnings:
Note 1050 Table 't2' already exists
select * from t2;
a
-1
call p_verify_reprepare_count(1);
SUCCESS
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result
index 112a86e0c88..f209e401764 100644
--- a/mysql-test/r/query_cache.result
+++ b/mysql-test/r/query_cache.result
@@ -701,6 +701,7 @@ drop table t1,t2,t3,t4;
set query_cache_wlock_invalidate=1;
create table t1 (a int not null);
create table t2 (a int not null);
+create view v1 as select * from t1;
select * from t1;
a
select * from t2;
@@ -713,6 +714,17 @@ show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
unlock table;
+select * from t1;
+a
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+lock table v1 write;
+show status like "Qcache_queries_in_cache";
+Variable_name Value
+Qcache_queries_in_cache 2
+unlock table;
+drop view v1;
drop table t1,t2;
set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
@@ -853,7 +865,7 @@ Variable_name Value
Qcache_queries_in_cache 0
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 18
+Qcache_inserts 19
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 6
@@ -866,7 +878,7 @@ Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
-Qcache_inserts 19
+Qcache_inserts 20
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 7
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index aa04bfc25ea..62acb2a7710 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1653,4 +1653,17 @@ a b
0 0
1 1
DROP TABLE t1;
+#
+# Bug #54802: 'NOT BETWEEN' evaluation is incorrect
+#
+CREATE TABLE t1 (c_key INT, c_notkey INT, KEY(c_key));
+INSERT INTO t1 VALUES (1, 1), (2, 2), (3, 3);
+EXPLAIN SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL c_key NULL NULL NULL 3 Using where
+SELECT * FROM t1 WHERE 2 NOT BETWEEN c_notkey AND c_key;
+c_key c_notkey
+1 1
+3 3
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/rowid_order_innodb.result b/mysql-test/r/rowid_order_innodb.result
index e0796cd7ab5..dc339304041 100644
--- a/mysql-test/r/rowid_order_innodb.result
+++ b/mysql-test/r/rowid_order_innodb.result
@@ -15,7 +15,7 @@ insert into t1 values (-5, 1, 1),
(10, 1, 1);
explain select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 4 Using sort_union(key1,key2); Using where
+1 SIMPLE t1 index_merge key1,key2 key1,key2 5,5 NULL 5 Using sort_union(key1,key2); Using where
select * from t1 force index(key1, key2) where key1 < 3 or key2 < 3;
pk1 key1 key2
-100 1 1
diff --git a/mysql-test/r/schema.result b/mysql-test/r/schema.result
index 853c3bcf575..809d652053e 100644
--- a/mysql-test/r/schema.result
+++ b/mysql-test/r/schema.result
@@ -16,21 +16,19 @@ drop schema foo;
# Bug #48940 MDL deadlocks against mysql_rm_db
#
DROP SCHEMA IF EXISTS schema1;
-DROP SCHEMA IF EXISTS schema2;
# Connection default
CREATE SCHEMA schema1;
-CREATE SCHEMA schema2;
CREATE TABLE schema1.t1 (a INT);
SET autocommit= FALSE;
INSERT INTO schema1.t1 VALUES (1);
# Connection 2
DROP SCHEMA schema1;
# Connection default
-ALTER SCHEMA schema2 DEFAULT CHARACTER SET utf8;
+ALTER SCHEMA schema1 DEFAULT CHARACTER SET utf8;
+Got one of the listed errors
SET autocommit= TRUE;
# Connection 2
# Connection default
-DROP SCHEMA schema2;
#
# Bug #49988 MDL deadlocks with mysql_create_db, reload_acl_and_cache
#
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index b193a269288..e8628d72a46 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4338,6 +4338,7 @@ SHOW STATUS LIKE 'Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result
index 921d308097c..72419c6ec9d 100644
--- a/mysql-test/r/single_delete_update.result
+++ b/mysql-test/r/single_delete_update.result
@@ -25,6 +25,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -41,6 +42,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -74,6 +76,7 @@ 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 0
@@ -90,6 +93,7 @@ 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 5
@@ -120,6 +124,7 @@ 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 0
@@ -136,6 +141,7 @@ 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 1
@@ -170,6 +176,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -186,6 +193,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -214,6 +222,7 @@ 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 0
@@ -230,6 +239,7 @@ 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 1
@@ -256,6 +266,7 @@ 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 1
@@ -272,6 +283,7 @@ 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 1
@@ -301,6 +313,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -322,6 +335,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -357,6 +371,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -373,6 +388,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -406,6 +422,7 @@ 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 0
@@ -422,6 +439,7 @@ 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 5
@@ -464,6 +482,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -486,6 +505,7 @@ 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 4
Handler_read_rnd 0
@@ -502,6 +522,7 @@ 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 4
Handler_read_rnd 0
@@ -536,6 +557,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -552,6 +574,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -590,6 +613,7 @@ 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 0
@@ -606,6 +630,7 @@ 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 5
@@ -641,6 +666,7 @@ 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 0
@@ -657,6 +683,7 @@ 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 1
@@ -691,6 +718,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -707,6 +735,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 5
@@ -735,6 +764,7 @@ 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 0
@@ -751,6 +781,7 @@ 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 1
@@ -778,6 +809,7 @@ 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 1
@@ -794,6 +826,7 @@ 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 1
@@ -824,6 +857,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 4
@@ -845,6 +879,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 7
Handler_read_prev 0
Handler_read_rnd 8
@@ -884,6 +919,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 0
@@ -900,6 +936,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 4
Handler_read_rnd 5
@@ -938,6 +975,7 @@ 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 0
@@ -954,6 +992,7 @@ 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 5
@@ -990,6 +1029,7 @@ SHOW STATUS LIKE 'Handler_read_%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
+Handler_read_last 0
Handler_read_next 4
Handler_read_prev 0
Handler_read_rnd 0
@@ -1012,6 +1052,7 @@ 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 4
Handler_read_rnd 0
@@ -1028,6 +1069,7 @@ 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 4
Handler_read_rnd 5
diff --git a/mysql-test/r/sp-lock.result b/mysql-test/r/sp-lock.result
index a7823175b3c..0d3e87f17e2 100644
--- a/mysql-test/r/sp-lock.result
+++ b/mysql-test/r/sp-lock.result
@@ -148,12 +148,12 @@ f1()
# Sending 'drop procedure p1'...
drop procedure p1;
# --> connection con2
-# Waitng for 'drop procedure t1' to get blocked on MDL lock...
+# Waiting for 'drop procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -174,12 +174,12 @@ f1()
# Sending 'create procedure p1'...
create procedure p1() begin end;
# --> connection con2
-# Waitng for 'create procedure t1' to get blocked on MDL lock...
+# Waiting for 'create procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -200,12 +200,12 @@ f1()
# Sending 'alter procedure p1'...
alter procedure p1 contains sql;
# --> connection con2
-# Waitng for 'alter procedure t1' to get blocked on MDL lock...
+# Waiting for 'alter procedure t1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -226,12 +226,12 @@ f1()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -252,12 +252,12 @@ f1()
# Sending 'create function f1'...
create function f1() returns int return 2;
# --> connection con2
-# Waitng for 'create function f1' to get blocked on MDL lock...
+# Waiting for 'create function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -279,12 +279,12 @@ f1()
# Sending 'alter function f1'...
alter function f1 contains sql;
# --> connection con2
-# Waitng for 'alter function f1' to get blocked on MDL lock...
+# Waiting for 'alter function f1' to get blocked on MDL lock...
# Demonstrate that there is a pending exclusive lock.
# Sending 'select f1()'...
select f1();
# --> connection con3
-# Waitng for 'select f1()' to get blocked by a pending MDL lock...
+# Waiting for 'select f1()' to get blocked by a pending MDL lock...
# --> connection default
commit;
# --> connection con1
@@ -360,7 +360,7 @@ insert into t1 (a) values (1);
# Sending 'drop function f1'
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -379,7 +379,7 @@ a
# Sending 'drop function f1'
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -403,7 +403,7 @@ a
# Sending 'drop procedure p1'
drop procedure p1;
# --> connection con2
-# Waitng for 'drop procedure p1' to get blocked on MDL lock...
+# Waiting for 'drop procedure p1' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -424,7 +424,7 @@ insert into t1 (a) values (3);
# Sending 'drop function f2'
drop function f2;
# --> connection con2
-# Waitng for 'drop function f2' to get blocked on MDL lock...
+# Waiting for 'drop function f2' to get blocked on MDL lock...
# --> connnection default
commit;
# --> connection con1
@@ -479,11 +479,11 @@ f2()
# Sending 'drop function f1'...
drop function f1;
# --> connection con2
-# Waitng for 'drop function f1' to get blocked on MDL lock...
+# Waiting for 'drop function f1' to get blocked on MDL lock...
# Sending 'drop function f2'...
drop function f2;
# --> connection default
-# Waitng for 'drop function f2' to get blocked on MDL lock...
+# Waiting for 'drop function f2' to get blocked on MDL lock...
rollback to savepoint sv;
# --> connection con2
# Reaping 'drop function f2'...
@@ -537,10 +537,10 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
-# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
# Sending 'call p1()'...
call p1();
-# Waitng for 'call p1()' to get blocked on MDL lock on f1...
+# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
@@ -573,7 +573,7 @@ f1()
# Sending 'alter function f1 ...'...
alter function f1 comment "comment";
# --> connection con2
-# Waitng for 'alter function f1 ...' to get blocked on MDL lock...
+# Waiting for 'alter function f1 ...' to get blocked on MDL lock...
#
# We just mention p1() in the body of f2() to make
# sure that p1() is prelocked for f2().
@@ -595,7 +595,7 @@ select f2() into @var;
end|
# Sending 'call p1()'...
call p1();
-# Waitng for 'call p1()' to get blocked on MDL lock on f1...
+# Waiting for 'call p1()' to get blocked on MDL lock on f1...
# Let 'alter function f1 ...' go through...
commit;
# --> connection con1
@@ -634,7 +634,7 @@ get_lock("30977", 0)
# Sending 'select f3()'...
select f3();
# --> connection con1
-# Waitng for 'select f3()' to get blocked on the user level lock...
+# Waiting for 'select f3()' to get blocked on the user level lock...
# Do something to change the cache version.
create function f4() returns int return 4;
drop function f4;
diff --git a/mysql-test/r/sp-threads.result b/mysql-test/r/sp-threads.result
index a14d099c673..9b458e25615 100644
--- a/mysql-test/r/sp-threads.result
+++ b/mysql-test/r/sp-threads.result
@@ -35,7 +35,7 @@ call bug9486();
show processlist;
Id User Host db Command Time State Info
# root localhost test Sleep # NULL
-# root localhost test Query # Waiting for table update t1, t2 set val= 1 where id1=id2
+# root localhost test Query # Waiting for table metadata lock update t1, t2 set val= 1 where id1=id2
# root localhost test Query # NULL show processlist
# root localhost test Sleep # NULL
unlock tables;
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index 586e2e7822b..2962a12d9a2 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -113,6 +113,7 @@ 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 0
diff --git a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
index 36d82e4045f..b9b1c94ce1a 100644
--- a/mysql-test/r/trigger.result
+++ b/mysql-test/r/trigger.result
@@ -1420,9 +1420,7 @@ create trigger t1_ai after insert on t1 for each row set @a := 7;
create table t2 (j int);
insert into t2 values (1), (2);
set @a:="";
-create table if not exists t1 select * from t2;
-Warnings:
-Note 1050 Table 't1' already exists
+insert into t1 select * from t2;
select * from t1;
i
7
@@ -1434,9 +1432,7 @@ drop trigger t1_bi;
drop trigger t1_ai;
create table t3 (isave int);
create trigger t1_bi before insert on t1 for each row insert into t3 values (new.i);
-create table if not exists t1 select * from t2;
-Warnings:
-Note 1050 Table 't1' already exists
+insert into t1 select * from t2;
select * from t1;
i
7
@@ -1622,10 +1618,8 @@ After DELETE, old=REPLACE, inserting a new key
After INSERT, new=REPLACE, deleting the duplicate
truncate t1;
truncate t1_op_log;
-create table if not exists t1
+insert into t1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-Warnings:
-Note 1050 Table 't1' already exists
set @id=last_insert_id();
select * from t1;
id operation
@@ -1635,10 +1629,8 @@ operation
Before INSERT, new=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... SELECT, inserting a new key
truncate t1_op_log;
-create table if not exists t1 replace
+replace into t1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-Warnings:
-Note 1050 Table 't1' already exists
select * from t1;
id operation
1 CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
@@ -1817,10 +1809,8 @@ After DELETE, old=REPLACE, inserting a new key
After INSERT, new=REPLACE, deleting the duplicate
truncate t1;
truncate t1_op_log;
-create table if not exists v1
+insert into v1
select NULL, "CREATE TABLE ... SELECT, inserting a new key";
-Warnings:
-Note 1050 Table 'v1' already exists
set @id=last_insert_id();
select * from t1;
id operation
@@ -1830,10 +1820,8 @@ operation
Before INSERT, new=CREATE TABLE ... SELECT, inserting a new key
After INSERT, new=CREATE TABLE ... SELECT, inserting a new key
truncate t1_op_log;
-create table if not exists v1 replace
+replace into v1
select @id, "CREATE TABLE ... REPLACE SELECT, deleting a duplicate key";
-Warnings:
-Note 1050 Table 'v1' already exists
select * from t1;
id operation
1 CREATE TABLE ... REPLACE SELECT, deleting a duplicate key
@@ -2083,7 +2071,8 @@ BEGIN
UPDATE a_nonextisting_table SET a = 1;
END//
CREATE TABLE IF NOT EXISTS t2 ( a INT, b INT ) SELECT a, b FROM t1;
-ERROR 42S02: Table 'test.a_nonextisting_table' doesn't exist
+Warnings:
+Note 1050 Table 't2' already exists
SELECT * FROM t2;
a b
DROP TABLE t1, t2;
diff --git a/mysql-test/r/type_bit_innodb.result b/mysql-test/r/type_bit_innodb.result
index a9c3cae1770..909db576b27 100644
--- a/mysql-test/r/type_bit_innodb.result
+++ b/mysql-test/r/type_bit_innodb.result
@@ -233,7 +233,7 @@ a+0 b+0
127 403
explain select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range a a 2 NULL 19 Using where; Using index; Using filesort
+1 SIMPLE t1 range a a 2 NULL 27 Using where; Using index; Using filesort
select a+0, b+0 from t1 where a > 40 and b > 200 order by 1;
a+0 b+0
44 307
diff --git a/mysql-test/r/union.result b/mysql-test/r/union.result
index 2080f4e8b61..33fc4333d1c 100644
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@ -428,7 +428,7 @@ ERROR 42000: Incorrect usage/placement of 'SQL_CALC_FOUND_ROWS'
create temporary table t1 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;
diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result
index 05ab1b71018..54170ae3dad 100644
--- a/mysql-test/r/update.result
+++ b/mysql-test/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
@@ -284,6 +285,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 2
@@ -294,6 +296,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
@@ -304,6 +307,7 @@ 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 0
@@ -315,6 +319,7 @@ 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 1
@@ -368,6 +373,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
@@ -405,6 +411,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -415,6 +422,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -424,6 +432,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
@@ -433,6 +442,7 @@ show status like '%Handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
+Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0