From ee8fd1e3b5ad0581ef3ce0e1a528b532bd77ddad Mon Sep 17 00:00:00 2001 From: "bar@mysql.com" <> Date: Fri, 23 Jun 2006 18:00:49 +0500 Subject: [PATCH] Bug#15276: MySQL ignores collation-server Problem: mysqld --collation-server=xxx --character-set-server=yyy didn't work as expected: collation_server was set not to xxx, but to the default collation of character set "yyy". With different argument order it worked as expected: mysqld --character-set-server=yyy --collation-server=yyy Fix: initializate default_collation_name to 0 when processing --character-set-server only if --collation-server has not been specified in command line. --- mysql-test/r/ctype_ucs2_def.result | 3 +++ mysql-test/t/ctype_ucs2_def-master.opt | 2 +- mysql-test/t/ctype_ucs2_def.test | 5 +++++ sql/mysqld.cc | 6 ++++-- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/ctype_ucs2_def.result b/mysql-test/r/ctype_ucs2_def.result index 897dbac251c..2f9dc4ae616 100644 --- a/mysql-test/r/ctype_ucs2_def.result +++ b/mysql-test/r/ctype_ucs2_def.result @@ -1,3 +1,6 @@ +show variables like 'collation_server'; +Variable_name Value +collation_server ucs2_unicode_ci show variables like "%character_set_ser%"; Variable_name Value character_set_server ucs2 diff --git a/mysql-test/t/ctype_ucs2_def-master.opt b/mysql-test/t/ctype_ucs2_def-master.opt index 1f884ff1d67..a0b5b061860 100644 --- a/mysql-test/t/ctype_ucs2_def-master.opt +++ b/mysql-test/t/ctype_ucs2_def-master.opt @@ -1 +1 @@ ---default-character-set=ucs2 --default-collation=ucs2_unicode_ci +--default-collation=ucs2_unicode_ci --default-character-set=ucs2 diff --git a/mysql-test/t/ctype_ucs2_def.test b/mysql-test/t/ctype_ucs2_def.test index fb174d551cf..00f636d79dc 100644 --- a/mysql-test/t/ctype_ucs2_def.test +++ b/mysql-test/t/ctype_ucs2_def.test @@ -1,3 +1,8 @@ +# +# MySQL Bug#15276: MySQL ignores collation-server +# +show variables like 'collation_server'; + # # Bug#18004 Connecting crashes server when default charset is UCS2 # diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d7a38d6b715..2feead9e3bd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -323,6 +323,7 @@ static char *default_character_set_name; static char *character_set_filesystem_name; static char *my_bind_addr_str; static char *default_collation_name; +static char compiled_default_collation_name[]= MYSQL_DEFAULT_COLLATION_NAME; static char mysql_data_home_buff[2]; static struct passwd *user_info; static I_List thread_cache; @@ -6389,7 +6390,7 @@ static void mysql_init_variables(void) /* Variables in libraries */ charsets_dir= 0; default_character_set_name= (char*) MYSQL_DEFAULT_CHARSET_NAME; - default_collation_name= (char*) MYSQL_DEFAULT_COLLATION_NAME; + default_collation_name= compiled_default_collation_name; sys_charset_system.value= (char*) system_charset_info->csname; character_set_filesystem_name= (char*) "binary"; @@ -6551,7 +6552,8 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), strmake(mysql_home,argument,sizeof(mysql_home)-1); break; case 'C': - default_collation_name= 0; + if (default_collation_name == compiled_default_collation_name) + default_collation_name= 0; break; case 'l': opt_log=1;