diff --git a/VERSION b/VERSION index 2e9a9392854ed..eb45175874ad3 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=11 -MYSQL_VERSION_PATCH=10 +MYSQL_VERSION_PATCH=11 SERVER_MATURITY=stable diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result index d91faf4c3d6d0..75eb5ccd4f0d3 100644 --- a/mysql-test/main/ctype_binary.result +++ b/mysql-test/main/ctype_binary.result @@ -3454,3 +3454,51 @@ DROP TABLE t1; # # End of 10.5 tests # +# +# Start of 10.11 tests +# +# +# MDEV-28767 Collation "binary" is not accepted for databases, tables, columns +# +CREATE TABLE t1 (a CHAR(1) COLLATE binary); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` binary(1) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a enum('a') CHARACTER SET binary COLLATE binary DEFAULT NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('a') CHARACTER SET binary DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a enum('a') COLLATE binary DEFAULT NULL); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` enum('a') CHARACTER SET binary DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1 COLLATE binary); +ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1' +CREATE TABLE t1 (a CHAR(10)) COLLATE binary; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` binary(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=binary +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE binary; +ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1' +CREATE DATABASE db1 COLLATE binary; +SHOW CREATE DATABASE db1; +Database Create Database +db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET binary */ +DROP DATABASE db1; +CREATE DATABASE db1 CHARACTER SET latin1 COLLATE binary; +ERROR 42000: COLLATION 'binary' is not valid for CHARACTER SET 'latin1' +# +# End of 10.11 tests +# diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index 756c96fcf60ef..9537f09e9b13b 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -294,3 +294,50 @@ DROP TABLE t1; --echo # --echo # End of 10.5 tests --echo # + +--echo # +--echo # Start of 10.11 tests +--echo # + +--echo # +--echo # MDEV-28767 Collation "binary" is not accepted for databases, tables, columns +--echo # + +# Column level + +CREATE TABLE t1 (a CHAR(1) COLLATE binary); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (a enum('a') CHARACTER SET binary COLLATE binary DEFAULT NULL); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t1 (a enum('a') COLLATE binary DEFAULT NULL); +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_COLLATION_CHARSET_MISMATCH +CREATE TABLE t1 (a CHAR(1) CHARACTER SET latin1 COLLATE binary); + + +# Table level +CREATE TABLE t1 (a CHAR(10)) COLLATE binary; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_COLLATION_CHARSET_MISMATCH +CREATE TABLE t1 (a CHAR(10)) CHARACTER SET latin1 COLLATE binary; + + +# Database level +CREATE DATABASE db1 COLLATE binary; +SHOW CREATE DATABASE db1; +DROP DATABASE db1; + +--error ER_COLLATION_CHARSET_MISMATCH +CREATE DATABASE db1 CHARACTER SET latin1 COLLATE binary; + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index ab92f0d19d2ea..0924199bc4905 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6613,6 +6613,11 @@ collation_name: collation_name_or_default: collation_name { $$=$1; } | DEFAULT { $$.set_collate_default(); } + | BINARY // MySQL compatibility + { + const Lex_exact_collation bin(&my_charset_bin); + $$= Lex_extended_collation(bin); + } ; opt_default: @@ -6673,6 +6678,20 @@ binary: { $$.set_collate_default(); } + | charset_or_alias COLLATE_SYM BINARY // MySQL compatibility + { + const Lex_exact_collation bin(&my_charset_bin); + Lex_extended_collation tmp(bin); + if (tmp.merge_exact_charset(Lex_exact_charset($1))) + MYSQL_YYABORT; + $$= Lex_exact_charset_extended_collation_attrs(tmp); + } + | COLLATE_SYM BINARY // MySQL compatibility + { + const Lex_exact_collation bin(&my_charset_bin); + const Lex_extended_collation tmp(bin); + $$= Lex_exact_charset_extended_collation_attrs(tmp); + } ; opt_bin_mod: