diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index d8b57381904..a7875d63aa2 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -2032,6 +2032,7 @@ int main(int argc, char** argv) { usage(); free_defaults(defaults_argv); + my_end(my_end_arg); exit(1); } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 1d821c18111..9845a3ec060 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6338,7 +6338,7 @@ void free_win_path_patterns() for (i=0 ; i < patterns.elements ; i++) { const char** pattern= dynamic_element(&patterns, i, const char**); - my_free(*pattern); + my_free((void *) *pattern); } delete_dynamic(&patterns); } diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index 2b413831076..e972a6bdec8 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -52,7 +52,7 @@ mystringsextra= strto.c dbugobjects = dbug.lo mysysheaders = mysys_priv.h my_static.h vioheaders = vio_priv.h -mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ +mysysobjects1 = my_init.lo my_static.lo my_malloc.lo \ my_create.lo my_delete.lo mf_tempfile.lo my_open.lo \ my_file.lo my_read.lo my_write.lo errors.lo \ my_error.lo my_getwd.lo my_div.lo \ diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index d6bfa23017e..77913fc8c18 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1606,6 +1606,25 @@ drop function f1; --echo # End of WL#2649 Number-to-string conversions --echo # +--echo # +--echo # Bug#54668 User variable assignments get wrong type +--echo # +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +SET @x=password('a'); +SELECT charset(@x), collation(@x); +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); + + --echo # --echo # Bug#52159 returning time type from function and empty left join causes debug assertion --echo # diff --git a/mysql-test/r/ctype_binary.result b/mysql-test/r/ctype_binary.result index 4b93e6533d7..76a4d0f3cf3 100644 --- a/mysql-test/r/ctype_binary.result +++ b/mysql-test/r/ctype_binary.result @@ -2567,6 +2567,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +binary binary +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_cp1251.result b/mysql-test/r/ctype_cp1251.result index 869a84a34c9..f93cb5f9a12 100644 --- a/mysql-test/r/ctype_cp1251.result +++ b/mysql-test/r/ctype_cp1251.result @@ -2649,6 +2649,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +cp1251 cp1251_general_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 8dbd09741ff..43ee365cd53 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -2977,6 +2977,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +latin1 latin1_swedish_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 892e893db4d..7bb27e03acc 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -3809,6 +3809,37 @@ drop function f1; # End of WL#2649 Number-to-string conversions # # +# Bug#54668 User variable assignments get wrong type +# +SET @x=md5('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=old_password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=password('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=sha1('a'); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=astext(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +SET @x=aswkt(point(1,2)); +SELECT charset(@x), collation(@x); +charset(@x) collation(@x) +ucs2 ucs2_general_ci +# # Bug#52159 returning time type from function and empty left join causes debug assertion # CREATE FUNCTION f1() RETURNS TIME RETURN 1; diff --git a/sql/filesort.cc b/sql/filesort.cc index af9387c3129..2398785a038 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -355,7 +355,7 @@ void filesort_free_buffers(TABLE *table, bool full) table->sort.sort_keys= NULL; my_free(table->sort.buffpek); table->sort.buffpek= NULL; - table->sort.buffpek_len= NULL; + table->sort.buffpek_len= 0; } my_free(table->sort.addon_buf); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 2a9eef2298d..851d0e07a7e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -72,7 +72,12 @@ String *Item_str_ascii_func::val_str(String *str) DBUG_ASSERT(fixed == 1); if (!(collation.collation->state & MY_CS_NONASCII)) - return val_str_ascii(str); + { + String *res= val_str_ascii(str); + if (res) + res->set_charset(collation.collation); + return res; + } DBUG_ASSERT(str != &ascii_buf);