diff options
-rw-r--r-- | mysql-test/r/mysql.result | 2 | ||||
-rw-r--r-- | mysql-test/t/mysql.test | 5 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/mysql-test/r/mysql.result b/mysql-test/r/mysql.result index 65f163a7acc..25b66fe7fc6 100644 --- a/mysql-test/r/mysql.result +++ b/mysql-test/r/mysql.result @@ -186,6 +186,8 @@ delimiter 2 2 2 +@z:='1' @z=database() +1 NULL End of 5.0 tests WARNING: --server-arg option not supported in this configuration. Warning (Code 1286): Unknown table engine 'nonexistent' diff --git a/mysql-test/t/mysql.test b/mysql-test/t/mysql.test index f17613a68a5..a182da5fbea 100644 --- a/mysql-test/t/mysql.test +++ b/mysql-test/t/mysql.test @@ -310,6 +310,11 @@ EOF --exec $MYSQL -c < $MYSQLTEST_VARDIR/tmp/bug38158.sql 2>&1 remove_file $MYSQLTEST_VARDIR/tmp/bug38158.sql; +# +# Bug #41437: Value stored in 'case' lacks charset, causees segfault +# +--exec $MYSQL -e "select @z:='1',@z=database()" + --echo End of 5.0 tests # diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index bb3f4821c4f..fc9375e68a5 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1782,6 +1782,12 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs) Item_string *conv; uint conv_errors; String tmp, cstr, *ostr= val_str(&tmp); + if (null_value) + { + Item *null_item= new Item_null((char *) fully_qualified_func_name()); + null_item->collation.set (tocs); + return null_item; + } cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); if (conv_errors || !(conv= new Item_static_string_func(fully_qualified_func_name(), |