summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-16 17:02:40 -0300
committerDavi Arnaut <Davi.Arnaut@Sun.COM>2010-07-16 17:02:40 -0300
commit59c0e16d62799399c0626708d12fae7683583ff7 (patch)
tree9bfb69814170eac641aa29a388bf4c3ce38a7248 /mysql-test
parentef87d588c5dd57117c47b3249b0720dcf6a4b0b9 (diff)
parent2c3a5626008f2589d4c2d9eac854a9098871d7f5 (diff)
downloadmariadb-git-59c0e16d62799399c0626708d12fae7683583ff7.tar.gz
Merge of mysql-trunk-merge into mysql-trunk-bugfixing.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/diff_tables.inc18
-rw-r--r--[-rwxr-xr-x]mysql-test/include/parser_bug21114.inc0
-rw-r--r--mysql-test/include/rpl_diff_tables.inc35
-rw-r--r--[-rwxr-xr-x]mysql-test/include/show_msg.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/include/show_msg80.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/Handles.pm0
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_kill_win.cc0
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc2
-rw-r--r--[-rwxr-xr-x]mysql-test/lib/My/SafeProcess/safe_process_win.cc0
-rw-r--r--[-rwxr-xr-x]mysql-test/r/bug46080.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/r/ctype_eucjpms.result0
-rw-r--r--mysql-test/r/error_simulation.result35
-rw-r--r--mysql-test/r/func_in.result20
-rw-r--r--mysql-test/r/func_like.result14
-rw-r--r--mysql-test/r/having.result16
-rw-r--r--mysql-test/r/information_schema.result27
-rw-r--r--mysql-test/r/information_schema_parameters.result30
-rw-r--r--mysql-test/r/information_schema_routines.result60
-rw-r--r--mysql-test/r/loaddata.result29
-rw-r--r--[-rwxr-xr-x]mysql-test/r/lowercase_mixed_tmpdir_innodb.result0
-rw-r--r--mysql-test/r/lowercase_view.result17
-rw-r--r--mysql-test/r/mysql_upgrade.result42
-rw-r--r--mysql-test/r/select.result15
-rw-r--r--mysql-test/r/subselect.result17
-rw-r--r--mysql-test/std_data/intersect-bug50389.tsv441
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result11
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result0
-rw-r--r--mysql-test/suite/binlog/t/binlog_base64_flag.test13
-rw-r--r--mysql-test/suite/funcs_1/r/is_basics_mixed.result2
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_innodb.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result76
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_memory.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_myisam.result12
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_mysql.result12
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/include/have_i54.inc0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test0
-rw-r--r--[-rwxr-xr-x]mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test0
-rw-r--r--mysql-test/suite/innodb/r/innodb_mysql.result70
-rw-r--r--mysql-test/suite/innodb/t/innodb_mysql.test61
-rw-r--r--mysql-test/suite/perfschema/r/pfs_upgrade.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_current_user.result205
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result2
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.cnf9
-rw-r--r--mysql-test/suite/rpl/t/rpl_current_user.test239
-rw-r--r--mysql-test/t/error_simulation.test31
-rw-r--r--mysql-test/t/func_in.test15
-rw-r--r--mysql-test/t/func_like.test18
-rw-r--r--mysql-test/t/having.test21
-rw-r--r--mysql-test/t/information_schema.test25
-rw-r--r--mysql-test/t/loaddata.test32
-rw-r--r--mysql-test/t/lowercase_view.test22
-rw-r--r--[-rwxr-xr-x]mysql-test/t/mysql_delimiter_19799.sql0
-rw-r--r--mysql-test/t/mysql_upgrade.test17
-rw-r--r--mysql-test/t/select.test11
-rw-r--r--mysql-test/t/subselect.test25
-rw-r--r--[-rwxr-xr-x]mysql-test/t/windows.test0
58 files changed, 1652 insertions, 129 deletions
diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc
index ad42615511a..d6216f3fe1e 100644
--- a/mysql-test/include/diff_tables.inc
+++ b/mysql-test/include/diff_tables.inc
@@ -65,17 +65,13 @@ let $_diff_table=$diff_table_2;
let $_diff_i=2;
while ($_diff_i) {
- # Parse out any leading "master:" or "slave:" from the table
- # specification and connect the appropriate server.
- let $_diff_conn_master=`SELECT SUBSTR('$_diff_table', 1, 7) = 'master:'`;
- if ($_diff_conn_master) {
- let $_diff_table=`SELECT SUBSTR('$_diff_table', 8)`;
- connection master;
- }
- let $_diff_conn_slave=`SELECT SUBSTR('$_diff_table', 1, 6) = 'slave:'`;
- if ($_diff_conn_slave) {
- let $_diff_table=`SELECT SUBSTR('$_diff_table', 7)`;
- connection slave;
+ # Parse out any leading "master:" or "slave:" from the table specification
+# and connect the appropriate server.
+ let $_pos= `SELECT LOCATE(':', '$_diff_table')`;
+ let $_diff_conn=`SELECT SUBSTR('$_diff_table', 1, $_pos-1)`;
+ if (`SELECT 'XX$_diff_conn' <> 'XX'`) {
+ let $_diff_table=`SELECT SUBSTR('$_diff_table', $_pos+1)`;
+ connection $_diff_conn;
}
# Sanity-check the input.
diff --git a/mysql-test/include/parser_bug21114.inc b/mysql-test/include/parser_bug21114.inc
index eb709d5cc03..eb709d5cc03 100755..100644
--- a/mysql-test/include/parser_bug21114.inc
+++ b/mysql-test/include/parser_bug21114.inc
diff --git a/mysql-test/include/rpl_diff_tables.inc b/mysql-test/include/rpl_diff_tables.inc
new file mode 100644
index 00000000000..c3a45578a79
--- /dev/null
+++ b/mysql-test/include/rpl_diff_tables.inc
@@ -0,0 +1,35 @@
+# #############################################################################
+# Check whether the given table is consistent between different master and
+# slaves
+#
+# Usage:
+# --let $diff_table= test.t1
+# --let $diff_server_list= master, slave, slave2
+# --source include/rpl_diff_tables.inc
+# #############################################################################
+
+if (`SELECT "XX$diff_table" = "XX"`)
+{
+ --die diff_table is null.
+}
+
+--let $_servers= master, slave
+if (`SELECT "XX$diff_server_list" <> "XX"`)
+{
+ --let $_servers= $diff_server_list
+}
+
+--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
+--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
+connection $_master;
+while (`SELECT "XX$_servers" <> "XX"`)
+{
+ --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
+ --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`
+
+ --sync_slave_with_master $_slave
+ --let $diff_table_1= $_master:$diff_table
+ --let $diff_table_2= $_slave:$diff_table
+ --source include/diff_tables.inc
+ connection $_slave;
+}
diff --git a/mysql-test/include/show_msg.inc b/mysql-test/include/show_msg.inc
index 659dce14686..659dce14686 100755..100644
--- a/mysql-test/include/show_msg.inc
+++ b/mysql-test/include/show_msg.inc
diff --git a/mysql-test/include/show_msg80.inc b/mysql-test/include/show_msg80.inc
index 42fb35edbcc..42fb35edbcc 100755..100644
--- a/mysql-test/include/show_msg80.inc
+++ b/mysql-test/include/show_msg80.inc
diff --git a/mysql-test/lib/My/Handles.pm b/mysql-test/lib/My/Handles.pm
index 66ee22b403f..66ee22b403f 100755..100644
--- a/mysql-test/lib/My/Handles.pm
+++ b/mysql-test/lib/My/Handles.pm
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index f72b851d0b6..f72b851d0b6 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 50c433b9b39..1c778362975 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -159,7 +159,7 @@ int main(int argc, char* const argv[] )
signal(SIGCHLD, handle_signal);
signal(SIGABRT, handle_abort);
- sprintf(safe_process_name, "safe_process[%d]", own_pid);
+ sprintf(safe_process_name, "safe_process[%ld]", (long) own_pid);
message("Started");
diff --git a/mysql-test/lib/My/SafeProcess/safe_process_win.cc b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
index 8fffede0b62..8fffede0b62 100755..100644
--- a/mysql-test/lib/My/SafeProcess/safe_process_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process_win.cc
diff --git a/mysql-test/r/bug46080.result b/mysql-test/r/bug46080.result
index 44f6bba8db6..44f6bba8db6 100755..100644
--- a/mysql-test/r/bug46080.result
+++ b/mysql-test/r/bug46080.result
diff --git a/mysql-test/r/ctype_eucjpms.result b/mysql-test/r/ctype_eucjpms.result
index bd25b1beed4..bd25b1beed4 100755..100644
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
diff --git a/mysql-test/r/error_simulation.result b/mysql-test/r/error_simulation.result
index fc58687cc86..b6b79cb596b 100644
--- a/mysql-test/r/error_simulation.result
+++ b/mysql-test/r/error_simulation.result
@@ -48,5 +48,40 @@ Got one of the listed errors
SET SESSION debug=DEFAULT;
DROP TABLE t1;
#
+# Bug#41660: Sort-index_merge for non-first join table may require
+# O(#scans) memory
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+# the example query uses LEFT JOIN only for the sake of being able to
+# demonstrate the issue with a very small dataset. (left outer join
+# disables the use of join buffering, so we get the second table
+# re-scanned for every record in the outer table. if we used inner join,
+# we would need to have thousands of records and/or more columns in both
+# tables so that the join buffer is filled and re-scans are triggered).
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+id select_type table type possible_keys key key_len ref rows Extra
+x x x x x x x x x
+x x x x x x x x x Using sort_union(a,b); Using where
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+a a b filler
+0 1 1 data
+1 1 1 data
+2 1 1 data
+3 1 1 data
+4 1 1 data
+5 1 1 data
+6 1 1 data
+7 1 1 data
+8 1 1 data
+9 1 1 data
+SET SESSION debug = DEFAULT;
+DROP TABLE t1, t2;
+#
# End of 5.1 tests
#
diff --git a/mysql-test/r/func_in.result b/mysql-test/r/func_in.result
index ffdacc43735..fdeec2755ca 100644
--- a/mysql-test/r/func_in.result
+++ b/mysql-test/r/func_in.result
@@ -750,4 +750,24 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
DROP TABLE t1;
#
+# Bug#54477: Crash on IN / CASE with NULL arguments
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+SELECT 1 IN (NULL, a) FROM t1;
+1 IN (NULL, a)
+1
+NULL
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+a IN (a, a)
+1
+1
+NULL
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+CASE a WHEN a THEN a END
+1
+2
+NULL
+DROP TABLE t1;
+#
End of 5.1 tests
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index 8d0f34f3bda..552ff564a89 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -169,3 +169,17 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
_cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê'
1
+End of 4.1 tests
+#
+# Bug #54575: crash when joining tables with unique set column
+#
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+Warnings:
+Warning 1364 Field 'a' doesn't have a default value
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+1
+DROP TABLE t1, t2;
+End of 5.1 tests
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index c69de0f307b..daf043860a4 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -532,3 +532,19 @@ Warnings:
Warning 1292 Truncated incorrect INTEGER value: 'd'
DROP TABLE t1,t2;
End of 5.0 tests
+#
+# Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
+#
+CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1,'f');
+CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
+INSERT INTO t2 VALUES (2,'m');
+INSERT INTO t2 VALUES (3,'m');
+INSERT INTO t2 VALUES (11,NULL);
+INSERT INTO t2 VALUES (12,'k');
+SELECT MAX(t1.f1) field1
+FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
+HAVING field1 < 7;
+field1
+DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result
index eb3abc3f0c9..21b42577a11 100644
--- a/mysql-test/r/information_schema.result
+++ b/mysql-test/r/information_schema.result
@@ -1681,6 +1681,33 @@ COUNT(*)
DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+
+Bug#54422 query with = 'variables'
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+COLUMN_DEFAULT TABLE_NAME
+NULL variables
+DROP TABLE variables;
+#
+# Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
+# should be 20
+#
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
+FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+TABLE_NAME COLUMN_NAME NUMERIC_PRECISION
+ubig a 19
+ubig b 20
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+Warnings:
+Warning 1264 Out of range value for column 'a' at row 1
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+length(CAST(b AS CHAR))
+20
+DROP TABLE ubig;
End of 5.1 tests.
#
# Additional test for WL#3726 "DDL locking for all metadata objects"
diff --git a/mysql-test/r/information_schema_parameters.result b/mysql-test/r/information_schema_parameters.result
index db04f5c0bd3..288f22e2ea3 100644
--- a/mysql-test/r/information_schema_parameters.result
+++ b/mysql-test/r/information_schema_parameters.result
@@ -25,7 +25,7 @@ WHERE table_schema = 'information_schema'
ORDER BY ordinal_position;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_CATALOG
ORDINAL_POSITION 1
COLUMN_DEFAULT
@@ -44,7 +44,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_SCHEMA
ORDINAL_POSITION 2
COLUMN_DEFAULT
@@ -63,7 +63,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 3
COLUMN_DEFAULT
@@ -82,7 +82,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME ORDINAL_POSITION
ORDINAL_POSITION 4
COLUMN_DEFAULT 0
@@ -101,7 +101,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_MODE
ORDINAL_POSITION 5
COLUMN_DEFAULT NULL
@@ -120,7 +120,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME PARAMETER_NAME
ORDINAL_POSITION 6
COLUMN_DEFAULT NULL
@@ -139,7 +139,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 7
COLUMN_DEFAULT
@@ -158,7 +158,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH
ORDINAL_POSITION 8
COLUMN_DEFAULT NULL
@@ -177,7 +177,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_OCTET_LENGTH
ORDINAL_POSITION 9
COLUMN_DEFAULT NULL
@@ -196,7 +196,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_PRECISION
ORDINAL_POSITION 10
COLUMN_DEFAULT NULL
@@ -215,7 +215,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME NUMERIC_SCALE
ORDINAL_POSITION 11
COLUMN_DEFAULT NULL
@@ -234,7 +234,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME CHARACTER_SET_NAME
ORDINAL_POSITION 12
COLUMN_DEFAULT NULL
@@ -253,7 +253,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME COLLATION_NAME
ORDINAL_POSITION 13
COLUMN_DEFAULT NULL
@@ -272,7 +272,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 14
COLUMN_DEFAULT NULL
@@ -291,7 +291,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME parameters
+TABLE_NAME PARAMETERS
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 15
COLUMN_DEFAULT
diff --git a/mysql-test/r/information_schema_routines.result b/mysql-test/r/information_schema_routines.result
index 664ec6bf748..aa4766f0a6b 100644
--- a/mysql-test/r/information_schema_routines.result
+++ b/mysql-test/r/information_schema_routines.result
@@ -40,7 +40,7 @@ WHERE table_schema = 'information_schema'
ORDER BY ordinal_position;
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SPECIFIC_NAME
ORDINAL_POSITION 1
COLUMN_DEFAULT
@@ -59,7 +59,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_CATALOG
ORDINAL_POSITION 2
COLUMN_DEFAULT
@@ -78,7 +78,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_SCHEMA
ORDINAL_POSITION 3
COLUMN_DEFAULT
@@ -97,7 +97,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_NAME
ORDINAL_POSITION 4
COLUMN_DEFAULT
@@ -116,7 +116,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_TYPE
ORDINAL_POSITION 5
COLUMN_DEFAULT
@@ -135,7 +135,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DATA_TYPE
ORDINAL_POSITION 6
COLUMN_DEFAULT
@@ -154,7 +154,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_MAXIMUM_LENGTH
ORDINAL_POSITION 7
COLUMN_DEFAULT NULL
@@ -173,7 +173,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_OCTET_LENGTH
ORDINAL_POSITION 8
COLUMN_DEFAULT NULL
@@ -192,7 +192,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME NUMERIC_PRECISION
ORDINAL_POSITION 9
COLUMN_DEFAULT NULL
@@ -211,7 +211,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME NUMERIC_SCALE
ORDINAL_POSITION 10
COLUMN_DEFAULT NULL
@@ -230,7 +230,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_SET_NAME
ORDINAL_POSITION 11
COLUMN_DEFAULT NULL
@@ -249,7 +249,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME COLLATION_NAME
ORDINAL_POSITION 12
COLUMN_DEFAULT NULL
@@ -268,7 +268,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DTD_IDENTIFIER
ORDINAL_POSITION 13
COLUMN_DEFAULT NULL
@@ -287,7 +287,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_BODY
ORDINAL_POSITION 14
COLUMN_DEFAULT
@@ -306,7 +306,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_DEFINITION
ORDINAL_POSITION 15
COLUMN_DEFAULT NULL
@@ -325,7 +325,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME EXTERNAL_NAME
ORDINAL_POSITION 16
COLUMN_DEFAULT NULL
@@ -344,7 +344,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME EXTERNAL_LANGUAGE
ORDINAL_POSITION 17
COLUMN_DEFAULT NULL
@@ -363,7 +363,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME PARAMETER_STYLE
ORDINAL_POSITION 18
COLUMN_DEFAULT
@@ -382,7 +382,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME IS_DETERMINISTIC
ORDINAL_POSITION 19
COLUMN_DEFAULT
@@ -401,7 +401,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_DATA_ACCESS
ORDINAL_POSITION 20
COLUMN_DEFAULT
@@ -420,7 +420,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_PATH
ORDINAL_POSITION 21
COLUMN_DEFAULT NULL
@@ -439,7 +439,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SECURITY_TYPE
ORDINAL_POSITION 22
COLUMN_DEFAULT
@@ -458,7 +458,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CREATED
ORDINAL_POSITION 23
COLUMN_DEFAULT 0000-00-00 00:00:00
@@ -477,7 +477,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME LAST_ALTERED
ORDINAL_POSITION 24
COLUMN_DEFAULT 0000-00-00 00:00:00
@@ -496,7 +496,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME SQL_MODE
ORDINAL_POSITION 25
COLUMN_DEFAULT
@@ -515,7 +515,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME ROUTINE_COMMENT
ORDINAL_POSITION 26
COLUMN_DEFAULT NULL
@@ -534,7 +534,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DEFINER
ORDINAL_POSITION 27
COLUMN_DEFAULT
@@ -553,7 +553,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME CHARACTER_SET_CLIENT
ORDINAL_POSITION 28
COLUMN_DEFAULT
@@ -572,7 +572,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME COLLATION_CONNECTION
ORDINAL_POSITION 29
COLUMN_DEFAULT
@@ -591,7 +591,7 @@ PRIVILEGES #
COLUMN_COMMENT
TABLE_CATALOG def
TABLE_SCHEMA information_schema
-TABLE_NAME routines
+TABLE_NAME ROUTINES
COLUMN_NAME DATABASE_COLLATION
ORDINAL_POSITION 30
COLUMN_DEFAULT
diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result
index a7407cfa699..1c59f41cfc0 100644
--- a/mysql-test/r/loaddata.result
+++ b/mysql-test/r/loaddata.result
@@ -503,4 +503,33 @@ DROP TABLE t1;
CREATE TABLE t1 (id INT NOT NULL);
LOAD DATA LOCAL INFILE 'tb.txt' INTO TABLE t1;
DROP TABLE t1;
+#
+# Bug #51876 : crash/memory underrun when loading data with ucs2
+# and reverse() function
+#
+# Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+Warnings:
+Warning 1366 Incorrect integer value: '?' for column 'a' at row 1
+Warning 1366 Incorrect integer value: '?' for column 'a' at row 2
+# should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+a
+0
+0
+DROP TABLE t1;
+# Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+# should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+a
+0
+1
+DROP TABLE t1;
End of 5.1 tests
diff --git a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
index a478b49cfda..a478b49cfda 100755..100644
--- a/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
+++ b/mysql-test/r/lowercase_mixed_tmpdir_innodb.result
diff --git a/mysql-test/r/lowercase_view.result b/mysql-test/r/lowercase_view.result
index c37dc41c495..33c87ec101c 100644
--- a/mysql-test/r/lowercase_view.result
+++ b/mysql-test/r/lowercase_view.result
@@ -148,3 +148,20 @@ a
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests.
+#
+# Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+# returns nothing
+#
+CREATE TABLE `ttt` (
+`f1` char(3) NOT NULL,
+PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+count(COLUMN_NAME)
+1
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+count(*)
+1
+DROP TABLE `ttt`;
+End of 5.0 tests.
diff --git a/mysql-test/r/mysql_upgrade.result b/mysql-test/r/mysql_upgrade.result
index 394beb042a5..58f6ffd4040 100644
--- a/mysql-test/r/mysql_upgrade.result
+++ b/mysql-test/r/mysql_upgrade.result
@@ -169,4 +169,46 @@ DROP PROCEDURE testproc;
WARNING: NULL values of the 'character_set_client' column ('mysql.proc' table) have been updated with a default value (latin1). Please verify if necessary.
WARNING: NULL values of the 'collation_connection' column ('mysql.proc' table) have been updated with a default value (latin1_swedish_ci). Please verify if necessary.
WARNING: NULL values of the 'db_collation' column ('mysql.proc' table) have been updated with default values. Please verify if necessary.
+#
+# Bug #53613: mysql_upgrade incorrectly revokes
+# TRIGGER privilege on given table
+#
+GRANT USAGE ON *.* TO 'user3'@'%';
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
+Run mysql_upgrade with all privileges on a user
+mtr.global_suppressions OK
+mtr.test_suppressions OK
+mysql.columns_priv OK
+mysql.db OK
+mysql.event OK
+mysql.func OK
+mysql.general_log
+Error : You can't use locks with log tables.
+status : OK
+mysql.help_category OK
+mysql.help_keyword OK
+mysql.help_relation OK
+mysql.help_topic OK
+mysql.host OK
+mysql.ndb_binlog_index OK
+mysql.plugin OK
+mysql.proc OK
+mysql.procs_priv OK
+mysql.servers OK
+mysql.slow_log
+Error : You can't use locks with log tables.
+status : OK
+mysql.tables_priv OK
+mysql.time_zone OK
+mysql.time_zone_leap_second OK
+mysql.time_zone_name OK
+mysql.time_zone_transition OK
+mysql.time_zone_transition_type OK
+mysql.user OK
+SHOW GRANTS FOR 'user3'@'%';
+Grants for user3@%
+GRANT USAGE ON *.* TO 'user3'@'%'
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'
+DROP USER 'user3'@'%';
+End of 5.1 tests
The --upgrade-system-tables option was used, databases won't be touched.
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index b518522e2bf..b193a269288 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4856,6 +4856,21 @@ a b c
SELECT * FROM t1 WHERE 102 < c;
a b c
DROP TABLE t1;
+#
+# Bug #54459: Assertion failed: param.sort_length,
+# file .\filesort.cc, line 149 (part II)
+#
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL NULL NULL NULL NULL 3
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+1
+1
+1
+1
+DROP TABLE t1;
End of 5.1 tests
#
# Bug#54515: Crash in opt_range.cc::get_best_group_min_max on
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index e3aa87876ed..72d63e47d9a 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -4988,3 +4988,20 @@ t1_id total_amount
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+#
+# Bug #52711: Segfault when doing EXPLAIN SELECT with
+# union...order by (select... where...)
+#
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+# Should not crash
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+# Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+End of 5.1 tests
diff --git a/mysql-test/std_data/intersect-bug50389.tsv b/mysql-test/std_data/intersect-bug50389.tsv
new file mode 100644
index 00000000000..f84359603a8
--- /dev/null
+++ b/mysql-test/std_data/intersect-bug50389.tsv
@@ -0,0 +1,441 @@
+3304605 1221256 0 0 abcdefghijklmnopwrst
+3304606 1221259 0 0 abcdefghijklmnopwrst
+3304607 1221260 0 0 asdfghjklzxcvbnm
+3304629 1221273 0 0 asdfghjklzxcvbnm
+3304630 1221273 0 0 asdfghjklzxcvbnm
+3304634 1221259 0 0 asdfghjklzxcvbnm
+3304644 1221278 0 0 abcdefghijklmnopwrst
+3304648 1221278 0 0 abcdefghijklmnopwrst
+3304649 1221278 0 1 asdfghjklzxcvbnm
+3304650 1221278 0 0 asdfghjklzxcvbnm
+3304651 1221282 0 0 abcdefghijklmnopwrst
+3304660 1221287 0 0 asdfghjklzxcvbnm
+3304662 1221288 0 0 abcdefghijklmnopwrst
+3304663 1221288 0 0 abcdefghijklmnopwrst
+3304664 1221290 0 0 abcdefghijklmnopwrst
+3304670 1221290 0 0 asdfghjklzxcvbnm
+3304671 1221292 0 0 abcdefghijklmnopwrst
+3304672 1221287 0 0 asdfghjklzxcvbnm
+3304673 1221294 0 0 asdfghjklzxcvbnm
+3304674 1221287 0 0 asdfghjklzxcvbnm
+3304676 1221296 0 0 abcdefghijklmnopwrst
+3304677 1221287 0 0 abcdefghijklmnopwrst
+3304678 1221287 0 0 abcdefghijklmnopwrst
+3304679 1221297 0 0 asdfghjklzxcvbnm
+3304680 1221290 0 0 abcdefghijklmnopwrst
+3304681 1221290 0 0 abcdefghijklmnopwrst
+3304685 1221300 0 0 asdfghjklzxcvbnm
+3304687 1221302 0 0 abcdefghijklmnopwrst
+3304688 1221296 1221298 0 abcdefghijklmnopwrst
+3304692 1221309 0 0 asdfghjklzxcvbnm
+3304694 1221309 0 0 asdfghjklzxcvbnm
+3304695 1221290 0 0 abcdefghijklmnopwrst
+3304696 1221313 0 0 asdfghjklzxcvbnm
+3304701 1221314 0 0 asdfghjklzxcvbnm
+3304703 1221313 0 0 abcdefghijklmnopwrst
+3304707 1221313 0 0 asdfghjklzxcvbnm
+3304709 1221313 0 0 abcdefghijklmnopwrst
+3304713 1221314 0 0 abcdefghijklmnopwrst
+3304715 1221317 0 0 abcdefghijklmnopwrst
+3304717 1221319 0 0 asdfghjklzxcvbnm
+3304718 1221320 0 0 abcdefghijklmnopwrst
+3304723 1221314 0 0 abcdefghijklmnopwrst
+3304724 1221314 0 0 asdfghjklzxcvbnm
+3304725 1221300 0 0 asdfghjklzxcvbnm
+3304726 1221314 0 0 asdfghjklzxcvbnm
+3304730 1221326 0 0 asdfghjklzxcvbnm
+3304732 1221328 0 0 asdfghjklzxcvbnm
+3304733 1221329 0 0 asdfghjklzxcvbnm
+3304745 1221331 0 0 abcdefghijklmnopwrst
+3304747 1221300 0 0 abcdefghijklmnopwrst
+3304752 1221332 0 0 asdfghjklzxcvbnm
+3304756 1221333 0 0 asdfghjklzxcvbnm
+3304765 1221336 0 0 asdfghjklzxcvbnm
+3304767 1221338 0 0 abcdefghijklmnopwrst
+3304769 1221340 0 0 asdfghjklzxcvbnm
+3304770 1221328 0 0 asdfghjklzxcvbnm
+3304771 1221328 0 0 abcdefghijklmnopwrst
+3304773 1221340 0 0 asdfghjklzxcvbnm
+3304774 1221340 0 0 abcdefghijklmnopwrst
+3304775 1221338 1221342 1 asdfghjklzxcvbnm
+3304778 1221345 0 0 asdfghjklzxcvbnm
+3304786 1221332 0 0 asdfghjklzxcvbnm
+3304787 1221347 0 0 abcdefghijklmnopwrst
+3304789 1221347 0 0 asdfghjklzxcvbnm
+3304793 1221349 0 0 abcdefghijklmnopwrst
+3304794 1221350 0 0 asdfghjklzxcvbnm
+3304800 1221290 0 0 asdfghjklzxcvbnm
+3304802 1221290 0 0 asdfghjklzxcvbnm
+3304803 1221290 0 0 asdfghjklzxcvbnm
+3304810 1221356 0 0 asdfghjklzxcvbnm
+3304811 1221356 0 0 asdfghjklzxcvbnm
+3304821 1221364 0 0 asdfghjklzxcvbnm
+3304823 1221365 0 0 asdfghjklzxcvbnm
+3304824 1221366 0 0 abcdefghijklmnopwrst
+3304825 1221365 0 0 asdfghjklzxcvbnm
+3304826 1221367 0 0 asdfghjklzxcvbnm
+3304828 1221369 0 0 abcdefghijklmnopwrst
+3304829 1221366 1221368 0 asdfghjklzxcvbnm
+3304831 1221372 0 0 abcdefghijklmnopwrst
+3304832 1221364 1221373 0 abcdefghijklmnopwrst
+3304833 1221364 1221371 0 asdfghjklzxcvbnm
+3304834 1221364 0 0 abcdefghijklmnopwrst
+3304836 1221375 0 0 abcdefghijklmnopwrst
+3304837 1221364 0 0 abcdefghijklmnopwrst
+3304838 1221364 1221376 0 asdfghjklzxcvbnm
+3304840 1221372 0 0 asdfghjklzxcvbnm
+3304842 1221372 0 1 abcdefghijklmnopwrst
+3304844 1221372 0 0 asdfghjklzxcvbnm
+3304845 1221372 0 0 abcdefghijklmnopwrst
+3304847 1221382 0 0 abcdefghijklmnopwrst
+3304848 1221372 0 0 abcdefghijklmnopwrst
+3304849 1221372 0 0 asdfghjklzxcvbnm
+3304852 1221364 1221378 0 asdfghjklzxcvbnm
+3304853 1221383 0 0 abcdefghijklmnopwrst
+3304854 1221384 0 0 asdfghjklzxcvbnm
+3304855 1221347 0 0 asdfghjklzxcvbnm
+3304858 1221383 0 0 abcdefghijklmnopwrst
+3304862 1221386 0 0 abcdefghijklmnopwrst
+3304864 1221387 0 0 abcdefghijklmnopwrst
+3304867 1221389 0 0 abcdefghijklmnopwrst
+3304868 1221390 0 0 asdfghjklzxcvbnm
+3304869 1221391 0 0 asdfghjklzxcvbnm
+3304871 1221393 0 0 asdfghjklzxcvbnm
+3304874 1221395 0 0 abcdefghijklmnopwrst
+3304877 1221396 0 0 abcdefghijklmnopwrst
+3304879 1221396 0 0 asdfghjklzxcvbnm
+3304882 1221398 0 0 abcdefghijklmnopwrst
+3304883 1221399 0 0 abcdefghijklmnopwrst
+3304884 1221400 0 0 abcdefghijklmnopwrst
+3304889 1221405 0 0 abcdefghijklmnopwrst
+3304895 1221409 0 0 asdfghjklzxcvbnm
+3304899 1221395 0 0 asdfghjklzxcvbnm
+3304900 1221395 0 0 asdfghjklzxcvbnm
+3304902 1221395 0 0 abcdefghijklmnopwrst
+3304903 1221395 0 0 asdfghjklzxcvbnm
+3304924 1221414 0 0 abcdefghijklmnopwrst
+3304925 1221415 0 0 asdfghjklzxcvbnm
+3304935 1221416 0 0 asdfghjklzxcvbnm
+3304936 1221418 0 0 asdfghjklzxcvbnm
+3304944 1221419 0 0 abcdefghijklmnopwrst
+3304959 1221427 0 0 asdfghjklzxcvbnm
+3304963 1221415 0 0 asdfghjklzxcvbnm
+3304964 1221428 0 0 asdfghjklzxcvbnm
+3304965 1221429 0 0 abcdefghijklmnopwrst
+3304978 1221433 0 0 abcdefghijklmnopwrst
+3304986 1221437 0 0 asdfghjklzxcvbnm
+3304988 1221439 0 0 asdfghjklzxcvbnm
+3304994 1221441 0 0 asdfghjklzxcvbnm
+3304996 1221442 0 0 asdfghjklzxcvbnm
+3304998 1221443 0 0 asdfghjklzxcvbnm
+3305003 1221446 0 0 abcdefghijklmnopwrst
+3305008 1221433 0 0 abcdefghijklmnopwrst
+3305009 1221447 0 0 asdfghjklzxcvbnm
+3305012 1221447 0 0 asdfghjklzxcvbnm
+3305013 1221449 0 0 abcdefghijklmnopwrst
+3305015 1221451 0 0 asdfghjklzxcvbnm
+3305019 1221453 0 0 asdfghjklzxcvbnm
+3305023 1221449 0 0 asdfghjklzxcvbnm
+3305026 1221456 0 0 abcdefghijklmnopwrst
+3305028 1221457 0 0 asdfghjklzxcvbnm
+3305032 1221449 0 0 asdfghjklzxcvbnm
+3305037 1221453 0 0 asdfghjklzxcvbnm
+3305040 1221451 0 0 asdfghjklzxcvbnm
+3305061 1221446 0 0 abcdefghijklmnopwrst
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3305304 1221453 0 0 abcdefghijklmnopwrst
+3305308 1221453 0 1 abcdefghijklmnopwrst
+3305333 1221457 1221577 0 asdfghjklzxcvbnm
+3305335 1221453 0 0 asdfghjklzxcvbnm
+3305354 1221457 0 1 asdfghjklzxcvbnm
+3306089 1221442 0 0 abcdefghijklmnopwrst
+3306090 1221442 0 0 abcdefghijklmnopwrst
+3306092 1221442 0 0 asdfghjklzxcvbnm
+3306345 1221366 0 0 asdfghjklzxcvbnm
+3306349 1221366 0 0 asdfghjklzxcvbnm
+3306419 1221364 1221371 0 asdfghjklzxcvbnm
+3307390 1221453 0 0 abcdefghijklmnopwrst
+3308002 1221416 1221417 0 abcdefghijklmnopwrst
+3308331 1221366 1222821 0 abcdefghijklmnopwrst
+3309991 1221347 0 0 asdfghjklzxcvbnm
+3311917 1221287 0 0 abcdefghijklmnopwrst
+3311937 1221287 0 0 abcdefghijklmnopwrst
+3311945 1221287 0 0 asdfghjklzxcvbnm
+3311955 1221287 0 0 abcdefghijklmnopwrst
+3311961 1221287 0 0 asdfghjklzxcvbnm
+3311963 1221287 0 1 asdfghjklzxcvbnm
+3311968 1221287 0 0 asdfghjklzxcvbnm
+3311974 1221287 0 1 abcdefghijklmnopwrst
+3311976 1221287 0 1 abcdefghijklmnopwrst
+3311981 1221287 0 1 abcdefghijklmnopwrst
+3311985 1221287 0 1 asdfghjklzxcvbnm
+3312014 1221287 0 0 abcdefghijklmnopwrst
+3312018 1221287 0 1 abcdefghijklmnopwrst
+3312025 1221287 0 0 abcdefghijklmnopwrst
+3312027 1221287 0 0 abcdefghijklmnopwrst
+3312030 1221287 0 0 abcdefghijklmnopwrst
+3313755 1221288 0 0 abcdefghijklmnopwrst
+3313767 1221288 0 0 asdfghjklzxcvbnm
+3314668 1221290 0 0 asdfghjklzxcvbnm
+3314670 1221290 0 0 abcdefghijklmnopwrst
+3323440 1221338 0 0 abcdefghijklmnopwrst
+3323736 1221338 0 0 asdfghjklzxcvbnm
+3323739 1221338 0 0 asdfghjklzxcvbnm
+3324077 1221290 0 0 asdfghjklzxcvbnm
+3324081 1221290 0 0 abcdefghijklmnopwrst
+3324082 1221290 0 0 abcdefghijklmnopwrst
+3324639 1221457 1221563 1 asdfghjklzxcvbnm
+3326180 1221287 0 0 abcdefghijklmnopwrst
+3326204 1221287 0 0 asdfghjklzxcvbnm
+3326945 1221457 1221563 1 asdfghjklzxcvbnm
+3328393 1221364 1221373 0 asdfghjklzxcvbnm
+3328966 1221287 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3333449 1221278 1231113 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3340069 1221364 1221373 0 abcdefghijklmnopwrst
+3340073 1221364 1221373 0 abcdefghijklmnopwrst
+3340563 1221290 0 0 asdfghjklzxcvbnm
+3341553 1221453 0 0 abcdefghijklmnopwrst
+3345868 1221287 0 0 asdfghjklzxcvbnm
+3345873 1221287 0 0 abcdefghijklmnopwrst
+3345879 1221287 0 0 asdfghjklzxcvbnm
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3347053 1221287 0 0 asdfghjklzxcvbnm
+3347109 1221287 0 1 abcdefghijklmnopwrst
+3350589 1221372 1236415 0 abcdefghijklmnopwrst
+3350594 1221372 1236415 1 asdfghjklzxcvbnm
+3353871 1221457 0 0 asdfghjklzxcvbnm
+3354727 1221364 1221373 0 abcdefghijklmnopwrst
+3355270 1221393 0 1 abcdefghijklmnopwrst
+3357638 1221287 0 0 asdfghjklzxcvbnm
+3357644 1221287 0 0 abcdefghijklmnopwrst
+3357648 1221287 0 0 abcdefghijklmnopwrst
+3357651 1221287 0 0 asdfghjklzxcvbnm
+3357661 1221287 0 0 abcdefghijklmnopwrst
+3357678 1221287 0 0 abcdefghijklmnopwrst
+3357697 1221287 0 0 asdfghjklzxcvbnm
+3357737 1221287 0 0 asdfghjklzxcvbnm
+3357744 1221287 0 0 abcdefghijklmnopwrst
+3357754 1221287 0 1 asdfghjklzxcvbnm
+3357760 1221287 0 1 abcdefghijklmnopwrst
+3357774 1221287 0 1 abcdefghijklmnopwrst
+3357779 1221287 0 0 abcdefghijklmnopwrst
+3357796 1221287 0 0 asdfghjklzxcvbnm
+3357814 1221287 0 0 asdfghjklzxcvbnm
+3357833 1221287 0 1 asdfghjklzxcvbnm
+3357835 1221287 0 0 abcdefghijklmnopwrst
+3357840 1221287 0 1 asdfghjklzxcvbnm
+3357842 1221287 0 0 abcdefghijklmnopwrst
+3357845 1221287 0 1 abcdefghijklmnopwrst
+3357849 1221287 0 1 abcdefghijklmnopwrst
+3357852 1221287 0 0 abcdefghijklmnopwrst
+3358935 1221443 0 1 abcdefghijklmnopwrst
+3358967 1221443 0 1 abcdefghijklmnopwrst
+3359181 1221256 0 0 abcdefghijklmnopwrst
+3360512 1221319 0 0 asdfghjklzxcvbnm
+3362004 1221287 0 0 abcdefghijklmnopwrst
+3362009 1221287 0 1 abcdefghijklmnopwrst
+3362358 1221287 0 0 asdfghjklzxcvbnm
+3363214 1221287 0 0 abcdefghijklmnopwrst
+3363238 1221287 0 1 asdfghjklzxcvbnm
+3363616 1221287 0 1 asdfghjklzxcvbnm
+3363631 1221287 0 0 asdfghjklzxcvbnm
+3364281 1221287 0 0 abcdefghijklmnopwrst
+3365900 1221347 0 0 asdfghjklzxcvbnm
+3365901 1221347 0 0 asdfghjklzxcvbnm
+3365906 1221347 0 0 asdfghjklzxcvbnm
+3365907 1221347 0 0 asdfghjklzxcvbnm
+3365910 1221347 0 0 abcdefghijklmnopwrst
+3365936 1221347 0 0 abcdefghijklmnopwrst
+3367846 1221287 0 0 abcdefghijklmnopwrst
+3368011 1221428 0 0 abcdefghijklmnopwrst
+3369882 1221300 0 0 asdfghjklzxcvbnm
+3370856 1221443 0 0 asdfghjklzxcvbnm
+3370861 1221443 1221445 0 abcdefghijklmnopwrst
+3375327 1221443 0 0 abcdefghijklmnopwrst
+3375333 1221443 1221445 0 abcdefghijklmnopwrst
+3376219 1221453 0 1 abcdefghijklmnopwrst
+3376228 1221453 0 0 abcdefghijklmnopwrst
+3376238 1221453 0 0 asdfghjklzxcvbnm
+3376243 1221453 0 0 abcdefghijklmnopwrst
+3376248 1221453 0 1 abcdefghijklmnopwrst
+3376254 1221453 0 0 abcdefghijklmnopwrst
+3376263 1221453 0 0 abcdefghijklmnopwrst
+3376272 1221453 0 1 asdfghjklzxcvbnm
+3376281 1221453 0 0 asdfghjklzxcvbnm
+3376290 1221453 0 0 abcdefghijklmnopwrst
+3376296 1221453 0 1 abcdefghijklmnopwrst
+3376301 1221453 0 0 asdfghjklzxcvbnm
+3376350 1221453 0 0 asdfghjklzxcvbnm
+3379002 1221453 0 0 abcdefghijklmnopwrst
+3379015 1221453 0 0 asdfghjklzxcvbnm
+3379025 1221453 0 0 abcdefghijklmnopwrst
+3379032 1221453 0 0 asdfghjklzxcvbnm
+3380181 1221372 1245650 0 asdfghjklzxcvbnm
+3380186 1221372 1245650 0 abcdefghijklmnopwrst
+3380190 1221372 1245650 0 asdfghjklzxcvbnm
+3380195 1221372 1245650 0 abcdefghijklmnopwrst
+3380202 1221372 1245650 0 asdfghjklzxcvbnm
+3380683 1221287 0 0 asdfghjklzxcvbnm
+3382317 1221453 0 0 abcdefghijklmnopwrst
+3382417 1221287 0 0 asdfghjklzxcvbnm
+3383523 1221338 0 1 abcdefghijklmnopwrst
+3387213 1221287 0 0 abcdefghijklmnopwrst
+3388139 1221453 0 0 asdfghjklzxcvbnm
+3398039 1221443 1251164 0 abcdefghijklmnopwrst
+3401835 1221453 0 0 asdfghjklzxcvbnm
+3412582 1221443 1255886 0 asdfghjklzxcvbnm
+3412583 1221443 1255886 0 asdfghjklzxcvbnm
+3413795 1221443 1255886 0 asdfghjklzxcvbnm
+3413813 1221443 1256258 0 asdfghjklzxcvbnm
+3420306 1221453 0 0 asdfghjklzxcvbnm
+3420354 1221453 0 0 asdfghjklzxcvbnm
+3425653 1221443 0 0 abcdefghijklmnopwrst
+3425658 1221443 0 0 asdfghjklzxcvbnm
+3431409 1221453 0 0 asdfghjklzxcvbnm
+3432510 1221443 1262320 0 asdfghjklzxcvbnm
+3432513 1221443 1262320 0 asdfghjklzxcvbnm
+3444444 1221443 1262320 0 abcdefghijklmnopwrst
+3445447 1221287 0 1 asdfghjklzxcvbnm
+3448662 1221338 0 0 asdfghjklzxcvbnm
+3450032 1221347 0 0 abcdefghijklmnopwrst
+3450259 1221453 0 0 abcdefghijklmnopwrst
+3452176 1221453 0 0 asdfghjklzxcvbnm
+3459239 1221347 0 0 asdfghjklzxcvbnm
+3463196 1221347 0 0 abcdefghijklmnopwrst
+3468759 1221453 0 0 abcdefghijklmnopwrst
+3470988 1221457 0 0 asdfghjklzxcvbnm
+3477116 1221287 0 0 asdfghjklzxcvbnm
+3477639 1221372 1277136 0 abcdefghijklmnopwrst
+3477656 1221372 1277136 0 asdfghjklzxcvbnm
+3488071 1221256 1238964 0 abcdefghijklmnopwrst
+3488079 1221256 0 0 asdfghjklzxcvbnm
+3488108 1221256 0 1 asdfghjklzxcvbnm
+3507126 1221287 0 1 asdfghjklzxcvbnm
+3511898 1221347 0 0 asdfghjklzxcvbnm
+3521780 1221453 0 0 abcdefghijklmnopwrst
+3536908 1221287 0 0 abcdefghijklmnopwrst
+3544231 1221329 0 1 asdfghjklzxcvbnm
+3545379 1221329 1298955 0 abcdefghijklmnopwrst
+3545384 1221329 1298955 0 abcdefghijklmnopwrst
+3545387 1221329 1298955 0 abcdefghijklmnopwrst
+3545389 1221329 1298955 1 abcdefghijklmnopwrst
+3545398 1221329 1298955 1 abcdefghijklmnopwrst
+3555715 1221287 0 0 asdfghjklzxcvbnm
+3563557 1221329 1298955 0 abcdefghijklmnopwrst
+3564322 1221338 0 0 asdfghjklzxcvbnm
+3565475 1221453 0 0 abcdefghijklmnopwrst
+3577588 1221287 0 0 asdfghjklzxcvbnm
+3600047 1221453 0 0 abcdefghijklmnopwrst
+3600062 1221453 0 0 asdfghjklzxcvbnm
+3600071 1221453 0 0 abcdefghijklmnopwrst
+3600080 1221453 0 1 abcdefghijklmnopwrst
+3600086 1221453 0 0 asdfghjklzxcvbnm
+3600091 1221453 0 1 abcdefghijklmnopwrst
+3600097 1221453 0 0 asdfghjklzxcvbnm
+3600103 1221453 0 0 asdfghjklzxcvbnm
+3600106 1221453 0 0 abcdefghijklmnopwrst
+3600113 1221453 0 0 abcdefghijklmnopwrst
+3600119 1221453 0 0 asdfghjklzxcvbnm
+3600124 1221453 0 0 abcdefghijklmnopwrst
+3600144 1221453 0 0 asdfghjklzxcvbnm
+3600152 1221453 0 0 asdfghjklzxcvbnm
+3600165 1221453 0 0 asdfghjklzxcvbnm
+3610561 1221287 0 0 abcdefghijklmnopwrst
+3617030 1221329 0 0 asdfghjklzxcvbnm
+3628347 1221443 1327098 0 abcdefghijklmnopwrst
+3628348 1221443 1327098 0 abcdefghijklmnopwrst
+3628646 1221443 0 0 asdfghjklzxcvbnm
+3633673 1221372 1328838 0 abcdefghijklmnopwrst
+3648489 1221443 0 0 asdfghjklzxcvbnm
+3648490 1221443 0 0 asdfghjklzxcvbnm
+3648534 1221443 1333827 0 asdfghjklzxcvbnm
+3653046 1221329 1298955 0 asdfghjklzxcvbnm
+3662680 1221287 0 0 asdfghjklzxcvbnm
+3699529 1221288 0 0 asdfghjklzxcvbnm
+3706659 1221453 0 0 asdfghjklzxcvbnm
+3723399 1221287 0 1 asdfghjklzxcvbnm
+3749934 1221278 0 0 abcdefghijklmnopwrst
+3761370 1221443 1371176 0 asdfghjklzxcvbnm
+3765884 1221443 1333827 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3779574 1221457 1372998 1 abcdefghijklmnopwrst
+3784656 1221457 1372998 1 abcdefghijklmnopwrst
+3784700 1221457 1372998 1 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796187 1221457 1382427 1 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+3817277 1221457 1382427 0 asdfghjklzxcvbnm
+3828282 1221457 0 0 abcdefghijklmnopwrst
+3828297 1221457 0 0 abcdefghijklmnopwrst
+3828300 1221457 0 0 abcdefghijklmnopwrst
+3833022 1221287 0 0 asdfghjklzxcvbnm
+3856380 1221457 1395359 0 asdfghjklzxcvbnm
+3856391 1221457 0 0 asdfghjklzxcvbnm
+3861413 1221256 0 0 abcdefghijklmnopwrst
+3864734 1221393 0 1 abcdefghijklmnopwrst
+3868051 1221329 0 0 abcdefghijklmnopwrst
+3868059 1221329 0 0 abcdefghijklmnopwrst
+3869088 1221329 0 0 abcdefghijklmnopwrst
+3878669 1221329 1298955 0 asdfghjklzxcvbnm
+3878684 1221329 1298955 0 asdfghjklzxcvbnm
+3881785 1221287 0 0 abcdefghijklmnopwrst
+3882333 1221287 0 0 asdfghjklzxcvbnm
+3882389 1221287 0 0 abcdefghijklmnopwrst
+3908680 1221372 1245650 0 asdfghjklzxcvbnm
+3908690 1221372 1245650 0 asdfghjklzxcvbnm
+3908697 1221372 1245650 0 abcdefghijklmnopwrst
+3911434 1221453 0 0 abcdefghijklmnopwrst
+3911446 1221453 0 0 asdfghjklzxcvbnm
+3911448 1221453 0 0 abcdefghijklmnopwrst
+3911489 1221453 0 0 abcdefghijklmnopwrst
+3917384 1221453 0 0 abcdefghijklmnopwrst
+3939602 1221457 0 1 asdfghjklzxcvbnm
+3962210 1221453 0 0 asdfghjklzxcvbnm
+3963734 1221457 0 0 asdfghjklzxcvbnm
+3977364 1221287 0 0 asdfghjklzxcvbnm
+3981725 1221453 0 0 abcdefghijklmnopwrst
+4042952 1221453 0 0 abcdefghijklmnopwrst
+4042953 1221453 0 0 abcdefghijklmnopwrst
+4042958 1221453 0 0 abcdefghijklmnopwrst
+4042960 1221453 0 1 abcdefghijklmnopwrst
+4042965 1221453 0 0 asdfghjklzxcvbnm
+4066893 1221453 0 1 abcdefghijklmnopwrst
+4066896 1221453 0 0 abcdefghijklmnopwrst
+4066900 1221453 0 0 abcdefghijklmnopwrst
+4066908 1221453 0 0 abcdefghijklmnopwrst
+4066912 1221453 0 0 asdfghjklzxcvbnm
+4066915 1221453 0 0 asdfghjklzxcvbnm
+4066919 1221453 0 0 abcdefghijklmnopwrst
+4066924 1221453 0 0 asdfghjklzxcvbnm
+4066929 1221453 0 0 abcdefghijklmnopwrst
+4066934 1221453 0 0 asdfghjklzxcvbnm
+4066941 1221453 0 0 abcdefghijklmnopwrst
+4066946 1221453 0 0 asdfghjklzxcvbnm
+4066955 1221453 0 0 abcdefghijklmnopwrst
+4116291 1221433 1487238 0 asdfghjklzxcvbnm
+4116295 1221433 1487238 0 abcdefghijklmnopwrst
+4116450 1221433 1487238 0 abcdefghijklmnopwrst
+4121149 1221287 0 0 asdfghjklzxcvbnm
+4137325 1221453 0 0 abcdefghijklmnopwrst
+4149051 1221287 0 0 abcdefghijklmnopwrst
+4162347 1221287 0 0 abcdefghijklmnopwrst
+4164485 1221457 0 1 asdfghjklzxcvbnm
+4174706 1221457 0 0 abcdefghijklmnopwrst
+4178645 1221457 0 0 abcdefghijklmnopwrst
+4180122 1221457 1382427 0 asdfghjklzxcvbnm
+4180925 1221457 1382427 0 asdfghjklzxcvbnm
+4186417 1221457 0 0 abcdefghijklmnopwrst
+4189624 1221457 0 1 asdfghjklzxcvbnm
+4203132 1221453 0 0 asdfghjklzxcvbnm
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4278829 1221453 0 0 abcdefghijklmnopwrst
+4326422 1221453 0 0 abcdefghijklmnopwrst
+4337061 1221287 0 0 abcdefghijklmnopwrst
+4379354 1221287 0 0 abcdefghijklmnopwrst
+4404901 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4535721 1221287 0 0 asdfghjklzxcvbnm
+4559596 1221457 0 0 abcdefghijklmnopwrst
+4617751 1221393 0 0 abcdefghijklmnopwrst
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index 58c444c9571..7fb5e50a219 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -91,3 +91,14 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
ERROR HY000: master may suffer from http://bugs.mysql.com/bug.php?id=37426 so slave stops; check error log on slave for more info
drop table t1, char63_utf8, char128_utf8;
+#
+# Bug #54393: crash and/or valgrind errors in
+# mysql_client_binlog_statement
+#
+BINLOG '';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
+BINLOG '123';
+BINLOG '-2079193929';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
+BINLOG 'xç↓%~∙D╒ƒ╡';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
diff --git a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
index 43108222866..43108222866 100755..100644
--- a/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
+++ b/mysql-test/suite/binlog/r/binlog_stm_ctype_cp932.result
diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test
index e6271ec6ccc..3f1e4e98bec 100644
--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
@@ -150,3 +150,16 @@ iONkSBcBAAAAKwAAAMQBAAAQABAAAAAAAAEAA//4AQAAAAMAMTIzAQAAAA==
';
drop table t1, char63_utf8, char128_utf8;
+
+
+--echo #
+--echo # Bug #54393: crash and/or valgrind errors in
+--echo # mysql_client_binlog_statement
+--echo #
+--error ER_SYNTAX_ERROR
+BINLOG '';
+BINLOG '123';
+--error ER_SYNTAX_ERROR
+BINLOG '-2079193929';
+--error ER_SYNTAX_ERROR
+BINLOG 'xç↓%~∙D╒ƒ╡';
diff --git a/mysql-test/suite/funcs_1/r/is_basics_mixed.result b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
index ce0bb69e5ee..3ac17803688 100644
--- a/mysql-test/suite/funcs_1/r/is_basics_mixed.result
+++ b/mysql-test/suite/funcs_1/r/is_basics_mixed.result
@@ -328,7 +328,7 @@ ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_
SELECT table_schema,table_name FROM information_schema.tables
WHERE table_schema = 'information_schema' AND table_name = 'tables';
table_schema table_name
-information_schema tables
+information_schema TABLES
SELECT * FROM information_schema.table_privileges
WHERE table_schema = 'information_schema';
GRANTEE TABLE_CATALOG TABLE_SCHEMA TABLE_NAME PRIVILEGE_TYPE IS_GRANTABLE
diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
index 1fac7ca83db..12ec7e2a33e 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result
@@ -450,9 +450,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 0 0 NULL NULL latin1 latin1_swedish_ci char(0) select,insert,update,references
-def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 33 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 34 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 35 NULL YES decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -565,9 +565,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 0088b21ee04..ea13b8619ce 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -15,8 +15,8 @@ def information_schema COLLATIONS IS_DEFAULT 4 NO varchar 3 9 NULL NULL utf8 ut
def information_schema COLLATIONS SORTLEN 6 0 NO bigint NULL NULL 19 0 NULL NULL bigint(3) select
def information_schema COLLATION_CHARACTER_SET_APPLICABILITY CHARACTER_SET_NAME 2 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLLATION_CHARACTER_SET_APPLICABILITY COLLATION_NAME 1 NO varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
-def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS CHARACTER_MAXIMUM_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS CHARACTER_OCTET_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema COLUMNS CHARACTER_SET_NAME 13 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLLATION_NAME 14 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema COLUMNS COLUMN_COMMENT 19 NO varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
@@ -27,9 +27,9 @@ def information_schema COLUMNS COLUMN_TYPE 15 NULL NO longtext 4294967295 429496
def information_schema COLUMNS DATA_TYPE 8 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema COLUMNS EXTRA 17 NO varchar 27 81 NULL NULL utf8 utf8_general_ci varchar(27) select
def information_schema COLUMNS IS_NULLABLE 7 NO varchar 3 9 NULL NULL utf8 utf8_general_ci varchar(3) select
-def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS NUMERIC_PRECISION 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS NUMERIC_SCALE 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema COLUMNS ORDINAL_POSITION 5 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema COLUMNS PRIVILEGES 18 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema COLUMNS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema COLUMNS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -71,14 +71,14 @@ def information_schema EVENTS SQL_MODE 12 NO varchar 8192 24576 NULL NULL utf8
def information_schema EVENTS STARTS 13 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema EVENTS STATUS 15 NO varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
def information_schema EVENTS TIME_ZONE 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES AUTOEXTEND_SIZE 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES AVG_ROW_LENGTH 28 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES CHECKSUM 36 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES CHECK_TIME 35 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES CREATE_TIME 33 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES CREATION_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES DATA_FREE 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES DATA_LENGTH 29 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES DELETED_ROWS 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES ENGINE 10 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES EXTENT_SIZE 16 0 NO bigint NULL NULL 19 0 NULL NULL bigint(4) select
@@ -88,27 +88,27 @@ def information_schema FILES FILE_NAME 2 NULL YES varchar 64 192 NULL NULL utf8
def information_schema FILES FILE_TYPE 3 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema FILES FREE_EXTENTS 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES FULLTEXT_KEYS 11 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES INDEX_LENGTH 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES INITIAL_SIZE 17 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES LAST_ACCESS_TIME 22 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES LAST_UPDATE_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema FILES LOGFILE_GROUP_NAME 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES LOGFILE_GROUP_NUMBER 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
-def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES MAXIMUM_SIZE 18 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES MAX_DATA_LENGTH 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES RECOVER_TIME 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES ROW_FORMAT 26 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
def information_schema FILES STATUS 37 NO varchar 20 60 NULL NULL utf8 utf8_general_ci varchar(20) select
def information_schema FILES TABLESPACE_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TABLE_CATALOG 5 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TABLE_NAME 7 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES TABLE_ROWS 27 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema FILES TABLE_SCHEMA 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema FILES TOTAL_EXTENTS 15 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES TRANSACTION_COUNTER 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES UPDATE_COUNT 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(4) select
def information_schema FILES UPDATE_TIME 34 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema FILES VERSION 25 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema GLOBAL_STATUS VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema GLOBAL_STATUS VARIABLE_VALUE 2 NULL YES varchar 1024 3072 NULL NULL utf8 utf8_general_ci varchar(1024) select
def information_schema GLOBAL_VARIABLES VARIABLE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -140,29 +140,29 @@ def information_schema PARAMETERS ROUTINE_TYPE 15 NO varchar 9 27 NULL NULL utf
def information_schema PARAMETERS SPECIFIC_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema PARAMETERS SPECIFIC_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARAMETERS SPECIFIC_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS AVG_ROW_LENGTH 14 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS CHECKSUM 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS CHECK_TIME 21 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema PARTITIONS CREATE_TIME 19 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS DATA_FREE 18 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS DATA_LENGTH 15 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS INDEX_LENGTH 17 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS MAX_DATA_LENGTH 16 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS NODEGROUP 24 NO varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
def information_schema PARTITIONS PARTITION_COMMENT 23 NO varchar 80 240 NULL NULL utf8 utf8_general_ci varchar(80) select
def information_schema PARTITIONS PARTITION_DESCRIPTION 12 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS PARTITION_EXPRESSION 10 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS PARTITION_METHOD 8 NULL YES varchar 18 54 NULL NULL utf8 utf8_general_ci varchar(18) select
def information_schema PARTITIONS PARTITION_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS PARTITION_ORDINAL_POSITION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS SUBPARTITION_EXPRESSION 11 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PARTITIONS SUBPARTITION_METHOD 9 NULL YES varchar 12 36 NULL NULL utf8 utf8_general_ci varchar(12) select
def information_schema PARTITIONS SUBPARTITION_NAME 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS SUBPARTITION_ORDINAL_POSITION 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS TABLESPACE_NAME 25 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARTITIONS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
@@ -254,33 +254,33 @@ def information_schema STATISTICS SUB_PART 11 NULL YES bigint NULL NULL 19 0 NUL
def information_schema STATISTICS TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema STATISTICS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema STATISTICS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES AUTO_INCREMENT 14 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES AVG_ROW_LENGTH 9 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES CHECKSUM 19 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES CHECK_TIME 17 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema TABLES CREATE_OPTIONS 20 NULL YES varchar 255 765 NULL NULL utf8 utf8_general_ci varchar(255) select
def information_schema TABLES CREATE_TIME 15 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES DATA_FREE 13 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES DATA_LENGTH 10 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES ENGINE 5 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES INDEX_LENGTH 12 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES MAX_DATA_LENGTH 11 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES ROW_FORMAT 7 NULL YES varchar 10 30 NULL NULL utf8 utf8_general_ci varchar(10) select
def information_schema TABLES TABLE_CATALOG 1 NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512) select
def information_schema TABLES TABLE_COLLATION 18 NULL YES varchar 32 96 NULL NULL utf8 utf8_general_ci varchar(32) select
def information_schema TABLES TABLE_COMMENT 21 NO varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLES TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES TABLE_ROWS 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLES TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLES TABLE_TYPE 4 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLES UPDATE_TIME 16 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
-def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLES VERSION 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES AUTOEXTEND_SIZE 6 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES ENGINE 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES EXTENT_SIZE 5 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES LOGFILE_GROUP_NAME 4 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
-def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
-def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES MAXIMUM_SIZE 7 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
+def information_schema TABLESPACES NODEGROUP_ID 8 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema TABLESPACES TABLESPACE_COMMENT 9 NULL YES varchar 2048 6144 NULL NULL utf8 utf8_general_ci varchar(2048) select
def information_schema TABLESPACES TABLESPACE_NAME 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema TABLESPACES TABLESPACE_TYPE 3 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
diff --git a/mysql-test/suite/funcs_1/r/is_columns_memory.result b/mysql-test/suite/funcs_1/r/is_columns_memory.result
index b2a798c938c..8cb865e68db 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_memory.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_memory.result
@@ -437,9 +437,9 @@ def test tb1 f27 19 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 20 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 21 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
-def test tb1 f30 22 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 23 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 24 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 22 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 23 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 24 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 25 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 26 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 27 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -540,9 +540,9 @@ def test tb3 f143 20 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 21 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 22 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 23 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 24 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 24 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 25 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 26 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 27 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 28 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 29 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_myisam.result b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
index b7c972c7238..e4c86f7ca94 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_myisam.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_myisam.result
@@ -479,9 +479,9 @@ def test tb1 f27 27 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerof
def test tb1 f28 28 NULL YES int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb1 f29 29 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
def test tb1 f3 3 NULL YES char 1 1 NULL NULL latin1 latin1_swedish_ci char(1) select,insert,update,references
-def test tb1 f30 30 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb1 f31 31 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb1 f32 32 NULL YES bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f30 30 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb1 f31 31 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb1 f32 32 NULL YES bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb1 f33 33 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb1 f34 34 10 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb1 f35 35 0000000010 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
@@ -602,9 +602,9 @@ def test tb3 f143 26 99999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned se
def test tb3 f144 27 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f145 28 0000099999 NO int NULL NULL 10 0 NULL NULL int(10) unsigned zerofill select,insert,update,references
def test tb3 f146 29 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) select,insert,update,references
-def test tb3 f147 30 999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
-def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f147 30 999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def test tb3 f148 31 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
+def test tb3 f149 32 00000000000000999999 NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned zerofill select,insert,update,references
def test tb3 f150 33 1000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) select,insert,update,references
def test tb3 f151 34 999 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned select,insert,update,references
def test tb3 f152 35 0000001000 NO decimal NULL NULL 10 0 NULL NULL decimal(10,0) unsigned zerofill select,insert,update,references
diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
index bd548ac0a25..1ab2b3513f0 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result
@@ -97,13 +97,13 @@ def mysql host Select_priv 3 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('
def mysql host Show_view_priv 16 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Trigger_priv 20 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql host Update_priv 5 N NO enum 1 3 NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
-def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
+def mysql ndb_binlog_index deletes 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index epoch 3 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned PRI select,insert,update,references
def mysql ndb_binlog_index File 2 NULL NO varchar 255 255 NULL NULL latin1 latin1_swedish_ci varchar(255) select,insert,update,references
-def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
-def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 19 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index inserts 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index Position 1 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index schemaops 7 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
+def mysql ndb_binlog_index updates 5 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned select,insert,update,references
def mysql plugin dl 2 NO varchar 128 384 NULL NULL utf8 utf8_general_ci varchar(128) select,insert,update,references
def mysql plugin name 1 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) PRI select,insert,update,references
def mysql proc body 11 NULL NO longblob 4294967295 4294967295 NULL NULL NULL NULL longblob select,insert,update,references
diff --git a/mysql-test/suite/ibmdb2i/include/have_i54.inc b/mysql-test/suite/ibmdb2i/include/have_i54.inc
index 7054e196153..7054e196153 100755..100644
--- a/mysql-test/suite/ibmdb2i/include/have_i54.inc
+++ b/mysql-test/suite/ibmdb2i/include/have_i54.inc
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
index 8276b401073..8276b401073 100755..100644
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
+++ b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44232.result
diff --git a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
index 311e800e1b0..311e800e1b0 100755..100644
--- a/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
+++ b/mysql-test/suite/ibmdb2i/r/ibmdb2i_bug_44610.result
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
index ea29b5abcd4..ea29b5abcd4 100755..100644
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
+++ b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44232.test
diff --git a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
index da69b5d9148..da69b5d9148 100755..100644
--- a/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
+++ b/mysql-test/suite/ibmdb2i/t/ibmdb2i_bug_44610.test
diff --git a/mysql-test/suite/innodb/r/innodb_mysql.result b/mysql-test/suite/innodb/r/innodb_mysql.result
index 6d92d14e735..b418b62ec90 100644
--- a/mysql-test/suite/innodb/r/innodb_mysql.result
+++ b/mysql-test/suite/innodb/r/innodb_mysql.result
@@ -2468,6 +2468,76 @@ ENGINE=InnoDB;
INSERT INTO t1 VALUES (0, 77, 1, 3);
UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
DROP TABLE t1;
+#
+# Bug#50389 Using intersect does not return all rows
+#
+CREATE TABLE t1 (
+f1 INT(10) NOT NULL,
+f2 INT(10),
+f3 INT(10),
+f4 TINYINT(4),
+f5 VARCHAR(50),
+PRIMARY KEY (f1),
+KEY idx1 (f2,f5,f4),
+KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+f1 f2 f3 f4 f5
+3305175 1221457 0 0 abcdefghijklmnopwrst
+3329875 1221457 1382427 0 abcdefghijklmnopwrst
+3336022 1221457 0 0 abcdefghijklmnopwrst
+3346860 1221457 0 0 abcdefghijklmnopwrst
+3772880 1221457 0 0 abcdefghijklmnopwrst
+3784744 1221457 1382427 0 abcdefghijklmnopwrst
+3796193 1221457 0 0 abcdefghijklmnopwrst
+4228206 1221457 0 0 abcdefghijklmnopwrst
+4494153 1221457 0 0 abcdefghijklmnopwrst
+4559596 1221457 0 0 abcdefghijklmnopwrst
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+3470988,3305175,3329875,3817277,3856380,3796193,
+3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge PRIMARY,idx1,idx2 idx2,idx1,PRIMARY 7,60,4 NULL 1 Using intersect(idx2,idx1,PRIMARY); Using where
+DROP TABLE t1;
+#
+# Bug#51431 Wrong sort order after import of dump file
+#
+CREATE TABLE t1 (
+f1 INT(11) NOT NULL,
+f2 int(11) NOT NULL,
+f3 int(11) NOT NULL,
+f4 tinyint(1) NOT NULL,
+PRIMARY KEY (f1),
+UNIQUE KEY (f2, f3),
+KEY (f4)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+FLUSH TABLES;
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+f1 f2 f3 f4
+27 1 9922 1
+26 1 9921 1
+25 1 9920 1
+24 1 9919 1
+23 1 9918 1
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range f2,f4 f4 1 NULL 11 Using where
+DROP TABLE t1;
End of 5.1 tests
#
# Test for bug #39932 "create table fails if column for FK is in different
diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test
index 09e076c0506..fcd54075ecc 100644
--- a/mysql-test/suite/innodb/t/innodb_mysql.test
+++ b/mysql-test/suite/innodb/t/innodb_mysql.test
@@ -676,6 +676,67 @@ UPDATE t1 SET d = 0 WHERE b = 77 AND c = 25;
DROP TABLE t1;
+--echo #
+--echo # Bug#50389 Using intersect does not return all rows
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(10) NOT NULL,
+ f2 INT(10),
+ f3 INT(10),
+ f4 TINYINT(4),
+ f5 VARCHAR(50),
+ PRIMARY KEY (f1),
+ KEY idx1 (f2,f5,f4),
+ KEY idx2 (f2,f4)
+) ENGINE=InnoDB;
+
+LOAD DATA INFILE '../../std_data/intersect-bug50389.tsv' INTO TABLE t1;
+
+SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+EXPLAIN SELECT * FROM t1 WHERE f1 IN
+(3305028,3353871,3772880,3346860,4228206,3336022,
+ 3470988,3305175,3329875,3817277,3856380,3796193,
+ 3784744,4180925,4559596,3963734,3856391,4494153)
+AND f5 = 'abcdefghijklmnopwrst' AND f2 = 1221457 AND f4 = 0 ;
+
+DROP TABLE t1;
+
+--echo #
+--echo # Bug#51431 Wrong sort order after import of dump file
+--echo #
+
+CREATE TABLE t1 (
+ f1 INT(11) NOT NULL,
+ f2 int(11) NOT NULL,
+ f3 int(11) NOT NULL,
+ f4 tinyint(1) NOT NULL,
+ PRIMARY KEY (f1),
+ UNIQUE KEY (f2, f3),
+ KEY (f4)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+(1,1,991,1), (2,1,992,1), (3,1,993,1), (4,1,994,1), (5,1,995,1),
+(6,1,996,1), (7,1,997,1), (8,1,998,1), (10,1,999,1), (11,1,9910,1),
+(16,1,9911,1), (17,1,9912,1), (18,1,9913,1), (19,1,9914,1), (20,1,9915,1),
+(21,1,9916,1), (22,1,9917,1), (23,1,9918,1), (24,1,9919,1), (25,1,9920,1),
+(26,1,9921,1), (27,1,9922,1);
+
+FLUSH TABLES;
+
+SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+EXPLAIN SELECT * FROM t1 WHERE f2 = 1 AND f4 = TRUE
+ORDER BY f1 DESC LIMIT 5;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests
diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade.result b/mysql-test/suite/perfschema/r/pfs_upgrade.result
index 17b57ba2e46..2d0d82ef19c 100644
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result
@@ -26,7 +26,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_table";
Tables_in_performance_schema (user_table)
@@ -57,7 +57,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
show tables like "user_view";
Tables_in_performance_schema (user_view)
@@ -86,7 +86,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -115,7 +115,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.proc where db='performance_schema';
name
@@ -144,7 +144,7 @@ ERROR 1050 (42S01) at line 445: Table 'SETUP_CONSUMERS' already exists
ERROR 1050 (42S01) at line 462: Table 'SETUP_INSTRUMENTS' already exists
ERROR 1050 (42S01) at line 482: Table 'SETUP_OBJECTS' already exists
ERROR 1050 (42S01) at line 498: Table 'SETUP_TIMERS' already exists
-ERROR 1644 (HY000) at line 1140: Unexpected content found in the performance_schema database.
+ERROR 1644 (HY000) at line 1138: Unexpected content found in the performance_schema database.
FATAL ERROR: Upgrade failed
select name from mysql.event where db='performance_schema';
name
diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result
new file mode 100644
index 00000000000..69c20078531
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_current_user.result
@@ -0,0 +1,205 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+# On slave2
+# Connect slave2 to slave
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=SLAVE_MYPORT;,
+MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
+START SLAVE;
+
+# [On master]
+DROP VIEW IF EXISTS v_user;
+DROP VIEW IF EXISTS v_tables_priv;
+DROP VIEW IF EXISTS v_procs_priv;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS my_grant;
+DROP PROCEDURE IF EXISTS my_revoke;
+DROP FUNCTION IF EXISTS my_user;
+DROP EVENT IF EXISTS e1;
+CREATE TABLE t1(c1 char(100));
+CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
+CREATE PROCEDURE p1() SELECT 1;
+# bug48321_1-01234 has the max length(16) of user.
+GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
+
+# Make sure the max lengths of user and host
+# the user name is too lengh
+GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
+ERROR HY000: String '01234567890123456' is too long for user name (should be no longer than 16)
+# the host name is too lengh
+GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
+ERROR HY000: String '0123456789012345678901234567890123456789012345678901234567890' is too long for host name (should be no longer than 60)
+
+# User 'bug48321_1-01234' connects to master by conn1
+# [On conn1]
+# Verify 'REVOKE ALL' statement
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'GRANT ... ON TABLE ...' statement
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'GRANT ... ON PROCEDURE...' statement
+GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'GRANT ... ON *.* ...' statement
+GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'REVOKE ... ON TABLE ...' statement
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'REVOKE ... ON PROCEDURE...' statement
+REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
+Comparing tables master:test.v_procs_priv and slave:test.v_procs_priv
+Comparing tables master:test.v_procs_priv and slave2:test.v_procs_priv
+
+# Verify 'REVOKE ... ON *.* ...' statement
+REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'GRANT ...' statement in the procedure
+CREATE PROCEDURE my_grant()
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+call my_grant;
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'REVOKE ... ON TABLE ...' statement in the procedure
+CREATE PROCEDURE my_revoke()
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+call my_revoke;
+Comparing tables master:test.v_tables_priv and slave:test.v_tables_priv
+Comparing tables master:test.v_tables_priv and slave2:test.v_tables_priv
+
+# Verify 'RENAME USER ...' statement
+RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'DROP USER ...' statement
+GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
+DROP USER CURRENT_USER();
+Comparing tables master:test.v_user and slave:test.v_user
+Comparing tables master:test.v_user and slave2:test.v_user
+
+# Verify 'ALTER EVENT...' statement
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
+# Explicitly assign CURRENT_USER() to definer
+ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
+Comparing tables master:test.v_event and slave:test.v_event
+Comparing tables master:test.v_event and slave2:test.v_event
+
+# Session user will be set as definer, if the statement does not assign
+# a definer
+ALTER EVENT e1 ENABLE;
+Comparing tables master:test.v_event and slave:test.v_event
+Comparing tables master:test.v_event and slave2:test.v_event
+
+# Verify that this patch does not affect the calling of CURRENT_USER()
+# in the other statements
+# [On master]
+INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+1234
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+1234
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+1234
+# [On master]
+UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+root@localhost
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+@
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+@
+# [On master]
+DELETE FROM t1 WHERE c1=CURRENT_USER();
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+# [On slave]
+SELECT * FROM t1;
+c1
+# [On slave2]
+SELECT * FROM t1;
+c1
+# [On master]
+CREATE TABLE t2(c1 char(100));
+CREATE FUNCTION my_user() RETURNS VARCHAR(64)
+SQL SECURITY INVOKER
+BEGIN
+INSERT INTO t2 VALUES(CURRENT_USER());
+RETURN CURRENT_USER();
+END |
+INSERT INTO t1 VALUES(my_user());
+Warnings:
+Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system function that may return a different value on the slave.
+SELECT * FROM t1;
+c1
+root@localhost
+SELECT * FROM t2;
+c1
+root@localhost
+# [On slave]
+SELECT * FROM t1;
+c1
+@
+SELECT * FROM t2;
+c1
+@
+# [On slave2]
+SELECT * FROM t1;
+c1
+@
+SELECT * FROM t2;
+c1
+@
+
+# END
+DROP TABLE t1, t2;
+DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
+DROP PROCEDURE p1;
+DROP PROCEDURE my_grant;
+DROP PROCEDURE my_revoke;
+DROP FUNCTION my_user;
+DROP EVENT e1;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
index dd0a2d89d54..daef153cdef 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result
@@ -750,7 +750,7 @@ test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 lat
USE test_rpl;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
-test_rpl e2 @ SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
+test_rpl e2 root@localhost SYSTEM RECURRING NULL 1 # # NULL SLAVESIDE_DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
==========MASTER==========
SELECT COUNT(*) FROM t1;
COUNT(*)
diff --git a/mysql-test/suite/rpl/t/rpl_current_user.cnf b/mysql-test/suite/rpl/t/rpl_current_user.cnf
new file mode 100644
index 00000000000..999ee727a88
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_current_user.cnf
@@ -0,0 +1,9 @@
+!include ../my.cnf
+
+[mysqld.3]
+server-id=3
+log-bin=slave-bin
+
+[ENV]
+SLAVE_MYPORT1= @mysqld.3.port
+SLAVE_MYSOCK1= @mysqld.3.socket
diff --git a/mysql-test/suite/rpl/t/rpl_current_user.test b/mysql-test/suite/rpl/t/rpl_current_user.test
new file mode 100644
index 00000000000..79816ef6c95
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_current_user.test
@@ -0,0 +1,239 @@
+##############################################################################
+# BUG#48321 CURRENT_USER() incorrectly replicated for DROP/RENAME USER,
+# REVOKE, GRANT, ALTER EVENT
+#
+# Calling CURRENT_USER() results into inconsistency between slave and master,
+# as the slave SQL thread has different user with common users.
+#
+# After the patch for bug#48321, session's user will be written into query log
+# event if CURRENT_USER() is called in 'DROP/RENAME USER', 'REVOKE', 'GRANT',
+# 'ALTER EVENT'.
+#
+##############################################################################
+source include/master-slave.inc;
+source include/have_binlog_format_statement.inc;
+call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.*");
+
+--echo
+--echo # On slave2
+connect (slave2,127.0.0.1,root,,test,$SLAVE_MYPORT1,);
+connection slave2;
+
+--echo # Connect slave2 to slave
+--replace_result $SLAVE_MYPORT SLAVE_MYPORT;
+eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$SLAVE_MYPORT,
+ MASTER_LOG_FILE='slave-bin.000001', MASTER_USER='root';
+START SLAVE;
+source include/wait_for_slave_to_start.inc;
+
+--echo
+--echo # [On master]
+connection master;
+--disable_warnings
+DROP VIEW IF EXISTS v_user;
+DROP VIEW IF EXISTS v_tables_priv;
+DROP VIEW IF EXISTS v_procs_priv;
+DROP PROCEDURE IF EXISTS p1;
+DROP PROCEDURE IF EXISTS my_grant;
+DROP PROCEDURE IF EXISTS my_revoke;
+DROP FUNCTION IF EXISTS my_user;
+DROP EVENT IF EXISTS e1;
+--enable_warnings
+CREATE TABLE t1(c1 char(100));
+CREATE VIEW test.v_user AS SELECT * FROM mysql.user WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_tables_priv AS SELECT * FROM mysql.tables_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_procs_priv AS SELECT * FROM mysql.procs_priv WHERE User LIKE 'bug48321%';
+CREATE VIEW test.v_event AS SELECT definer FROM mysql.event WHERE name = 'e1';
+CREATE PROCEDURE p1() SELECT 1;
+--echo # bug48321_1-01234 has the max length(16) of user.
+GRANT ALL PRIVILEGES ON *.* TO 'bug48321_1-01234'@'localhost' WITH GRANT OPTION;
+
+--echo
+--echo # Make sure the max lengths of user and host
+--echo # the user name is too lengh
+--error 1470
+GRANT CREATE USER ON *.* TO '01234567890123456'@'fakehost';
+--echo # the host name is too lengh
+--error 1470
+GRANT CREATE USER ON *.* TO 'fakename'@'0123456789012345678901234567890123456789012345678901234567890';
+
+--echo
+--echo # User 'bug48321_1-01234' connects to master by conn1
+connect (conn1, 127.0.0.1, 'bug48321_1-01234'@'localhost',,);
+connection conn1;
+--echo # [On conn1]
+--echo # Verify 'REVOKE ALL' statement
+REVOKE ALL PRIVILEGES, GRANT OPTION FROM CURRENT_USER();
+let $diff_table= test.v_user;
+let $diff_server_list= master, slave, slave2;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON TABLE ...' statement
+connection conn1;
+GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON PROCEDURE...' statement
+connection conn1;
+GRANT ALTER ROUTINE, EXECUTE ON PROCEDURE p1 TO CURRENT_USER();
+let $diff_table= test.v_procs_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ... ON *.* ...' statement
+connection conn1;
+GRANT ALL PRIVILEGES ON *.* TO CURRENT_USER() WITH GRANT OPTION;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON TABLE ...' statement
+connection conn1;
+REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON PROCEDURE...' statement
+connection conn1;
+REVOKE ALTER ROUTINE, EXECUTE ON PROCEDURE p1 FROM CURRENT_USER();
+let $diff_table= test.v_procs_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON *.* ...' statement
+connection conn1;
+REVOKE ALL PRIVILEGES ON *.* FROM CURRENT_USER();
+let $diff_table= test.v_user;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'GRANT ...' statement in the procedure
+connection conn1;
+CREATE PROCEDURE my_grant()
+ GRANT CREATE, INSERT, SELECT ON TABLE test.t1 TO CURRENT_USER();
+call my_grant;
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'REVOKE ... ON TABLE ...' statement in the procedure
+connection conn1;
+CREATE PROCEDURE my_revoke()
+ REVOKE CREATE, INSERT, SELECT ON TABLE t1 FROM CURRENT_USER();
+call my_revoke;
+let $diff_table= test.v_tables_priv;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'RENAME USER ...' statement
+connection conn1;
+RENAME USER CURRENT_USER TO 'bug48321_2'@'localhost';
+let $diff_table= test.v_user;
+source include/rpl_diff_tables.inc;
+
+disconnect conn1;
+
+--echo
+--echo # Verify 'DROP USER ...' statement
+connection master;
+GRANT CREATE USER ON *.* TO 'bug48321_2'@'localhost';
+connect (conn1, 127.0.0.1, 'bug48321_2'@'localhost',,);
+connection conn1;
+DROP USER CURRENT_USER();
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify 'ALTER EVENT...' statement
+connection master;
+CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
+
+--echo # Explicitly assign CURRENT_USER() to definer
+ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
+let $diff_table= test.v_event;
+source include/rpl_diff_tables.inc;
+
+connection master;
+--echo
+--echo # Session user will be set as definer, if the statement does not assign
+--echo # a definer
+ALTER EVENT e1 ENABLE;
+sync_slave_with_master;
+source include/rpl_diff_tables.inc;
+
+--echo
+--echo # Verify that this patch does not affect the calling of CURRENT_USER()
+--echo # in the other statements
+connection master;
+--echo # [On master]
+INSERT INTO t1 VALUES(CURRENT_USER()), ('1234');
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+--echo # [On slave2]
+sync_slave_with_master slave2;
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+UPDATE t1 SET c1=CURRENT_USER() WHERE c1='1234';
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+DELETE FROM t1 WHERE c1=CURRENT_USER();
+SELECT * FROM t1;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+
+connection master;
+--echo # [On master]
+CREATE TABLE t2(c1 char(100));
+
+DELIMITER |;
+CREATE FUNCTION my_user() RETURNS VARCHAR(64)
+ SQL SECURITY INVOKER
+BEGIN
+ INSERT INTO t2 VALUES(CURRENT_USER());
+ RETURN CURRENT_USER();
+END |
+DELIMITER ;|
+
+INSERT INTO t1 VALUES(my_user());
+SELECT * FROM t1;
+SELECT * FROM t2;
+sync_slave_with_master;
+--echo # [On slave]
+SELECT * FROM t1;
+SELECT * FROM t2;
+sync_slave_with_master slave2;
+--echo # [On slave2]
+SELECT * FROM t1;
+SELECT * FROM t2;
+
+--echo
+--echo # END
+connection master;
+DROP TABLE t1, t2;
+DROP VIEW v_user, v_tables_priv, v_procs_priv, v_event;
+DROP PROCEDURE p1;
+DROP PROCEDURE my_grant;
+DROP PROCEDURE my_revoke;
+DROP FUNCTION my_user;
+DROP EVENT e1;
+sync_slave_with_master;
+sync_slave_with_master slave2;
+source include/master-slave-end.inc;
diff --git a/mysql-test/t/error_simulation.test b/mysql-test/t/error_simulation.test
index 7a48a2e3231..f6edacfaa29 100644
--- a/mysql-test/t/error_simulation.test
+++ b/mysql-test/t/error_simulation.test
@@ -45,7 +45,6 @@ SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;
-
--echo #
--echo # Bug#42064: low memory crash when importing hex strings, in Item_hex_string::Item_hex_string
--echo #
@@ -60,6 +59,36 @@ SET SESSION debug=DEFAULT;
DROP TABLE t1;
+-- echo #
+-- echo # Bug#41660: Sort-index_merge for non-first join table may require
+-- echo # O(#scans) memory
+-- echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+
+CREATE TABLE t2 (a INT, b INT, filler CHAR(100), KEY(a), KEY(b));
+INSERT INTO t2 SELECT 1000, 1000, 'filler' FROM t1 A, t1 B, t1 C;
+INSERT INTO t2 VALUES (1, 1, 'data');
+
+--echo # the example query uses LEFT JOIN only for the sake of being able to
+--echo # demonstrate the issue with a very small dataset. (left outer join
+--echo # disables the use of join buffering, so we get the second table
+--echo # re-scanned for every record in the outer table. if we used inner join,
+--echo # we would need to have thousands of records and/or more columns in both
+--echo # tables so that the join buffer is filled and re-scans are triggered).
+
+SET SESSION debug = '+d,only_one_Unique_may_be_created';
+
+--replace_column 1 x 2 x 3 x 4 x 5 x 6 x 7 x 8 x 9 x
+EXPLAIN
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+SELECT * FROM t1 LEFT JOIN t2 ON ( t2.a < 10 OR t2.b < 10 );
+
+SET SESSION debug = DEFAULT;
+
+DROP TABLE t1, t2;
+
--echo #
--echo # End of 5.1 tests
--echo #
diff --git a/mysql-test/t/func_in.test b/mysql-test/t/func_in.test
index 61ae812d874..6efeb2866e6 100644
--- a/mysql-test/t/func_in.test
+++ b/mysql-test/t/func_in.test
@@ -540,5 +540,20 @@ EXPLAIN SELECT * FROM t1 WHERE c_char IN (NULL, NULL);
DROP TABLE t1;
--echo #
+--echo # Bug#54477: Crash on IN / CASE with NULL arguments
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT 1 IN (NULL, a) FROM t1;
+
+SELECT a IN (a, a) FROM t1 GROUP BY a WITH ROLLUP;
+
+SELECT CASE a WHEN a THEN a END FROM t1 GROUP BY a WITH ROLLUP;
+
+DROP TABLE t1;
+
+--echo #
--echo End of 5.1 tests
diff --git a/mysql-test/t/func_like.test b/mysql-test/t/func_like.test
index 741ea5533da..1204d04d9a0 100644
--- a/mysql-test/t/func_like.test
+++ b/mysql-test/t/func_like.test
@@ -112,5 +112,19 @@ select 'andre%' like 'andreÊ%' escape 'Ê';
#
select _cp1251'andre%' like convert('andreÊ%' using cp1251) escape 'Ê';
-#
-# End of 4.1 tests
+
+--echo End of 4.1 tests
+
+
+--echo #
+--echo # Bug #54575: crash when joining tables with unique set column
+--echo #
+CREATE TABLE t1(a SET('a') NOT NULL, UNIQUE KEY(a));
+CREATE TABLE t2(b INT PRIMARY KEY);
+INSERT INTO t1 VALUES ();
+INSERT INTO t2 VALUES (1), (2), (3);
+SELECT 1 FROM t2 JOIN t1 ON 1 LIKE a GROUP BY a;
+DROP TABLE t1, t2;
+
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 65bf9518a5c..c808e747523 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -544,3 +544,24 @@ ORDER BY t1.f2;
DROP TABLE t1,t2;
--echo End of 5.0 tests
+
+--echo #
+--echo # Bug#54416 MAX from JOIN with HAVING returning NULL with 5.1 and Empty set
+--echo #
+
+CREATE TABLE t1 (f1 INT(11), f2 VARCHAR(1), PRIMARY KEY (f1));
+INSERT INTO t1 VALUES (1,'f');
+
+CREATE TABLE t2 (f1 INT(11), f2 VARCHAR(1));
+INSERT INTO t2 VALUES (2,'m');
+INSERT INTO t2 VALUES (3,'m');
+INSERT INTO t2 VALUES (11,NULL);
+INSERT INTO t2 VALUES (12,'k');
+
+SELECT MAX(t1.f1) field1
+FROM t1 JOIN t2 ON t2.f2 LIKE 'x'
+HAVING field1 < 7;
+
+DROP TABLE t1,t2;
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test
index 456cacf2fe1..87022d65fcc 100644
--- a/mysql-test/t/information_schema.test
+++ b/mysql-test/t/information_schema.test
@@ -1416,6 +1416,31 @@ DROP USER nonpriv;
DROP TABLE db1.t1;
DROP DATABASE db1;
+--echo
+--echo Bug#54422 query with = 'variables'
+--echo
+
+CREATE TABLE variables(f1 INT);
+SELECT COLUMN_DEFAULT, TABLE_NAME
+FROM INFORMATION_SCHEMA.COLUMNS
+WHERE INFORMATION_SCHEMA.COLUMNS.TABLE_NAME = 'variables';
+DROP TABLE variables;
+
+--echo #
+--echo # Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
+--echo # should be 20
+--echo #
+
+CREATE TABLE ubig (a BIGINT, b BIGINT UNSIGNED);
+
+SELECT TABLE_NAME, COLUMN_NAME, NUMERIC_PRECISION
+ FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='ubig';
+
+INSERT INTO ubig VALUES (0xFFFFFFFFFFFFFFFF,0xFFFFFFFFFFFFFFFF);
+SELECT length(CAST(b AS CHAR)) FROM ubig;
+
+DROP TABLE ubig;
+
--echo End of 5.1 tests.
diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test
index 27c4cc8a75c..06054d1990d 100644
--- a/mysql-test/t/loaddata.test
+++ b/mysql-test/t/loaddata.test
@@ -570,4 +570,36 @@ DROP TABLE t1;
connection default;
disconnect con1;
+
+--echo #
+--echo # Bug #51876 : crash/memory underrun when loading data with ucs2
+--echo # and reverse() function
+--echo #
+
+--echo # Problem # 1 (original report): wrong parsing of ucs2 data
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt';
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 2 zeroes (as the value is truncated)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp.txt;
+
+
+--echo # Problem # 2 : if you write and read ucs2 data to a file they're lost
+SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2;
+CREATE TABLE t1(a INT);
+LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2
+(@b) SET a=REVERSE(@b);
+--echo # should return 0 and 1 (10 reversed)
+SELECT * FROM t1;
+
+DROP TABLE t1;
+let $MYSQLD_DATADIR= `select @@datadir`;
+remove_file $MYSQLD_DATADIR/test/tmpp2.txt;
+
+
--echo End of 5.1 tests
diff --git a/mysql-test/t/lowercase_view.test b/mysql-test/t/lowercase_view.test
index d6612b3e6b9..52be911cde0 100644
--- a/mysql-test/t/lowercase_view.test
+++ b/mysql-test/t/lowercase_view.test
@@ -160,4 +160,26 @@ SELECT * FROM v1;
DROP VIEW v1;
DROP TABLE t1;
+
+--echo End of 5.0 tests.
+
+
+--echo #
+--echo # Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
+--echo # returns nothing
+--echo #
+
+CREATE TABLE `ttt` (
+ `f1` char(3) NOT NULL,
+ PRIMARY KEY (`f1`)
+) ENGINE=myisam DEFAULT CHARSET=latin1;
+
+SELECT count(COLUMN_NAME) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME =
+'TTT';
+SELECT count(*) FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 'TTT';
+
+DROP TABLE `ttt`;
+
+
--echo End of 5.0 tests.
+
diff --git a/mysql-test/t/mysql_delimiter_19799.sql b/mysql-test/t/mysql_delimiter_19799.sql
index 2a3d4378492..2a3d4378492 100755..100644
--- a/mysql-test/t/mysql_delimiter_19799.sql
+++ b/mysql-test/t/mysql_delimiter_19799.sql
diff --git a/mysql-test/t/mysql_upgrade.test b/mysql-test/t/mysql_upgrade.test
index 83d97954222..3ea612d2ca7 100644
--- a/mysql-test/t/mysql_upgrade.test
+++ b/mysql-test/t/mysql_upgrade.test
@@ -108,6 +108,23 @@ DROP PROCEDURE testproc;
--cat_file $MYSQLTEST_VARDIR/tmp/41569.txt
--remove_file $MYSQLTEST_VARDIR/tmp/41569.txt
+
+--echo #
+--echo # Bug #53613: mysql_upgrade incorrectly revokes
+--echo # TRIGGER privilege on given table
+--echo #
+
+GRANT USAGE ON *.* TO 'user3'@'%';
+GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%';
+--echo Run mysql_upgrade with all privileges on a user
+--exec $MYSQL_UPGRADE --skip-verbose --force 2>&1
+SHOW GRANTS FOR 'user3'@'%';
+
+DROP USER 'user3'@'%';
+
+--echo End of 5.1 tests
+
+
#
# Test the --upgrade-system-tables option
#
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 6f2d34459eb..495b6002986 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -4117,6 +4117,17 @@ SELECT * FROM t1 WHERE 102 < c;
DROP TABLE t1;
+--echo #
+--echo # Bug #54459: Assertion failed: param.sort_length,
+--echo # file .\filesort.cc, line 149 (part II)
+--echo #
+CREATE TABLE t1(a ENUM('') NOT NULL);
+INSERT INTO t1 VALUES (), (), ();
+EXPLAIN SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+SELECT 1 FROM t1 ORDER BY a COLLATE latin1_german2_ci;
+DROP TABLE t1;
+
+
--echo End of 5.1 tests
--echo #
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 06aaf5dfb7f..2e442e7f897 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -3921,3 +3921,28 @@ GROUP BY
DROP TABLE t3;
DROP TABLE t2;
DROP TABLE t1;
+
+
+--echo #
+--echo # Bug #52711: Segfault when doing EXPLAIN SELECT with
+--echo # union...order by (select... where...)
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(10), FULLTEXT KEY a (a));
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (1),(2);
+
+--echo # Should not crash
+--disable_result_log
+EXPLAIN
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+
+--echo # Should not crash
+SELECT * FROM t2 UNION SELECT * FROM t2
+ ORDER BY (SELECT * FROM t1 WHERE MATCH(a) AGAINST ('+abc' IN BOOLEAN MODE));
+DROP TABLE t1,t2;
+--enable_result_log
+
+--echo End of 5.1 tests
diff --git a/mysql-test/t/windows.test b/mysql-test/t/windows.test
index b7d31948d23..b7d31948d23 100755..100644
--- a/mysql-test/t/windows.test
+++ b/mysql-test/t/windows.test