diff options
author | Alexander Barkov <alexander.barkov@oracle.com> | 2012-03-20 09:16:51 +0400 |
---|---|---|
committer | Alexander Barkov <alexander.barkov@oracle.com> | 2012-03-20 09:16:51 +0400 |
commit | f75dbdd160749ae0f24528c211faccc0a744bc96 (patch) | |
tree | 2509a4934fc52229e017222f7b9db7622a086acc | |
parent | fb96d8089abcfd4ac8c97cd1989b5a464f1a39c8 (diff) | |
download | mariadb-git-f75dbdd160749ae0f24528c211faccc0a744bc96.tar.gz |
Bug#13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED. | MY_STRNXFRM_UNICODE/MAKE_SORTKEY
Problem:
Field_set::val_str in case of an empty SET value
returned a String with str_length==0 and Ptr==0,
which is not expected by some pieces of the code.
Fix:
Returning an empty string with str_length==0 and Ptr=="",
like Field_enum does.
-rw-r--r-- | mysql-test/r/ctype_ucs.result | 11 | ||||
-rw-r--r-- | mysql-test/t/ctype_ucs.test | 9 | ||||
-rw-r--r-- | sql/field.cc | 3 |
3 files changed, 21 insertions, 2 deletions
diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index dc922f8490a..06d4481a24b 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -4107,5 +4107,16 @@ DROP TABLE t1; SET sql_mode=default; SET NAMES latin1; # +# Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED +# +CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2); +Warnings: +Note 1291 Column 'c1' has duplicated value '' in SET +INSERT INTO t1 VALUES (''); +SELECT COALESCE(c1) FROM t1 ORDER BY 1; +COALESCE(c1) + +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index 24e68f2dab3..4d4d209692a 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -760,5 +760,14 @@ SET collation_connection=ucs2_general_ci; SET NAMES latin1; --echo # +--echo # Bug #13832953 MY_STRNXFRM_UNICODE: ASSERTION `SRC' FAILED +--echo # +CREATE TABLE t1 (c1 SET('','') CHARACTER SET ucs2); +INSERT INTO t1 VALUES (''); +SELECT COALESCE(c1) FROM t1 ORDER BY 1; +DROP TABLE t1; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/sql/field.cc b/sql/field.cc index ef66c1ba9bb..59eb83da5fa 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -8257,8 +8257,7 @@ String *Field_set::val_str(String *val_buffer, ulonglong tmp=(ulonglong) Field_enum::val_int(); uint bitnr=0; - val_buffer->length(0); - val_buffer->set_charset(field_charset); + val_buffer->set("", 0, field_charset); while (tmp && bitnr < (uint) typelib->count) { if (tmp & 1) |