Fix for bug#10732: Set SQL_MODE to NULL gives garbled error message

  generate proper error message if we use SET ... = NULL for 'set'
  variables
parent 90ddbe87
......@@ -138,3 +138,5 @@ t1 CREATE TABLE `t1` (
`min_num` decimal(7,6) default '0.000001'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1 ;
set @@SQL_MODE=NULL;
ERROR 42000: Variable 'sql_mode' can't be set to the value of 'NULL'
......@@ -80,3 +80,8 @@ create table t1 ( min_num dec(6,6) default .000001);
show create table t1;
drop table t1 ;
#
# Bug #10732: Set SQL_MODE to NULL gives garbled error message
#
--error 1231
set @@SQL_MODE=NULL;
......@@ -1515,7 +1515,10 @@ bool sys_var::check_set(THD *thd, set_var *var, TYPELIB *enum_names)
if (var->value->result_type() == STRING_RESULT)
{
if (!(res= var->value->val_str(&str)))
{
strmake(buff, "NULL", 4);
goto err;
}
var->save_result.ulong_value= ((ulong)
find_set(enum_names, res->c_ptr(),
res->length(),
......
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