Commit 399845ae authored by unknown's avatar unknown

Better error messages for not nullable

SET character_set_xxx=NULL
and
SET collation_xxx=NULL

parent 5babbd23
...@@ -233,6 +233,10 @@ set character_set_client=UNKNOWN_CHARACTER_SET; ...@@ -233,6 +233,10 @@ set character_set_client=UNKNOWN_CHARACTER_SET;
ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET' ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
set collation_connection=UNKNOWN_COLLATION; set collation_connection=UNKNOWN_COLLATION;
ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION' ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION'
set character_set_client=NULL;
ERROR 42000: Variable 'character_set_client' can't be set to the value of 'NULL'
set collation_connection=NULL;
ERROR 42000: Variable 'collation_connection' can't be set to the value of 'NULL'
set global autocommit=1; set global autocommit=1;
ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with SET GLOBAL ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with SET GLOBAL
select @@global.timestamp; select @@global.timestamp;
......
...@@ -137,6 +137,10 @@ set GLOBAL storage_engine=DEFAULT; ...@@ -137,6 +137,10 @@ set GLOBAL storage_engine=DEFAULT;
set character_set_client=UNKNOWN_CHARACTER_SET; set character_set_client=UNKNOWN_CHARACTER_SET;
--error 1273 --error 1273
set collation_connection=UNKNOWN_COLLATION; set collation_connection=UNKNOWN_COLLATION;
--error 1231
set character_set_client=NULL;
--error 1231
set collation_connection=NULL;
--error 1228 --error 1228
set global autocommit=1; set global autocommit=1;
--error 1238 --error 1238
......
...@@ -1678,7 +1678,10 @@ bool sys_var_collation::check(THD *thd, set_var *var) ...@@ -1678,7 +1678,10 @@ bool sys_var_collation::check(THD *thd, set_var *var)
String str(buff,sizeof(buff), system_charset_info), *res; String str(buff,sizeof(buff), system_charset_info), *res;
if (!(res=var->value->val_str(&str))) if (!(res=var->value->val_str(&str)))
res= &my_empty_string; {
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1;
}
if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0)))) if (!(tmp=get_charset_by_name(res->c_ptr(),MYF(0))))
{ {
...@@ -1700,7 +1703,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var) ...@@ -1700,7 +1703,7 @@ bool sys_var_character_set::check(THD *thd, set_var *var)
{ {
if (!nullable) if (!nullable)
{ {
my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "NULL"); my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, "NULL");
return 1; return 1;
} }
tmp= NULL; tmp= NULL;
......
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