Commit ea04a8cf authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-6805 one can set character_set_client to utf32

use the same restriction for character_set_client on the command line
and from SQL.

Also: remove strange hack from thd_init_client_charset() that contradicted
the manual (collation_connection and character_set_result were not always set)
parent a8bd285f
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
show variables like 'collation_server';
Variable_name Value
collation_server ucs2_unicode_ci
......
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
#
# Start of 5.5 tests
#
......
call mtr.add_suppression("Cannot use utf16 as character_set_client");
SHOW VARIABLES LIKE 'collation_server';
Variable_name Value
collation_server utf16_general_ci
......
......@@ -11,7 +11,7 @@ SELECT @@global.character_set_connection;
utf8
SELECT @@session.character_set_connection;
@@session.character_set_connection
utf8
latin1
'#--------------------FN_DYNVARS_011_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;
......
......@@ -9,7 +9,7 @@ SELECT @@global.character_set_results;
utf8
SELECT @@session.character_set_results;
@@session.character_set_results
utf8
latin1
'#--------------------FN_DYNVARS_012_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;
......
......@@ -9,7 +9,7 @@ SELECT @@global.collation_connection;
latin1_danish_ci
SELECT @@session.collation_connection;
@@session.collation_connection
latin1_danish_ci
latin1_swedish_ci
'#--------------------FN_DYNVARS_015_02-------------------------#'
'connection default'
DROP TABLE IF EXISTS t1;
......
-- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
#
# MySQL Bug#15276: MySQL ignores collation-server
#
......
-- source include/have_query_cache.inc
-- source include/have_ucs2.inc
call mtr.add_suppression("Cannot use ucs2 as character_set_client");
--echo #
--echo # Start of 5.5 tests
--echo #
......
--source include/have_utf16.inc
call mtr.add_suppression("Cannot use utf16 as character_set_client");
#
# Bug #32391 Character sets: crash with --character-set-server
......
......@@ -4268,7 +4268,15 @@ static int init_common_variables()
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
if (default_charset_info->mbminlen > 1)
{
global_system_variables.character_set_client= &my_charset_latin1;
sql_print_warning("Cannot use %s as character_set_client, %s will be used instead",
default_charset_info->csname,
global_system_variables.character_set_client->csname);
}
else
global_system_variables.character_set_client= default_charset_info;
if (!(character_set_filesystem=
get_charset_by_csname(character_set_filesystem_name,
......
......@@ -837,14 +837,10 @@ bool thd_init_client_charset(THD *thd, uint cs_number)
Use server character set and collation if
- opt_character_set_client_handshake is not set
- client has not specified a character set
- client character set is the same as the servers
- client character set doesn't exists in server
*/
if (!opt_character_set_client_handshake ||
!(cs= get_charset(cs_number, MYF(0))) ||
!my_strcasecmp(&my_charset_latin1,
global_system_variables.character_set_client->name,
cs->name))
!(cs= get_charset(cs_number, MYF(0))))
{
thd->variables.character_set_client=
global_system_variables.character_set_client;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment