diff --git a/mysql-test/r/ctype_ldml.result b/mysql-test/r/ctype_ldml.result index f3d3ff700f06d94de03bd8b9240009eb447337f0..5dc9ea35cc38de4da3b88f97e40ba8212262aa09 100644 --- a/mysql-test/r/ctype_ldml.result +++ b/mysql-test/r/ctype_ldml.result @@ -21,6 +21,25 @@ select * from t1 where c1='b'; c1 a drop table t1; +CREATE TABLE t1 ( +col1 varchar(100) character set utf8 collate utf8_test_ci +); +INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl'); +ALTER TABLE t1 ADD FULLTEXT INDEX (col1); +SELECT * FROM t1 where match (col1) against ('abcd'); +col1 +abcd +SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE); +col1 +abcd +ALTER TABLE t1 ADD (col2 varchar(100) character set latin1); +UPDATE t1 SET col2=col1; +SELECT * FROM t1 WHERE col1=col2 ORDER BY col1; +col1 col2 +abcd abcd +efgh efgh +ijkl ijkl +DROP TABLE t1; show collation like 'ucs2_vn_ci'; Collation Charset Id Default Compiled Sortlen ucs2_vn_ci ucs2 242 8 diff --git a/mysql-test/t/ctype_ldml.test b/mysql-test/t/ctype_ldml.test index fc6ed0f25795e62a1633d4cc79e7542ea475f5a6..73a23a751e8deadc5f800ac82a868e28aa74e1a6 100644 --- a/mysql-test/t/ctype_ldml.test +++ b/mysql-test/t/ctype_ldml.test @@ -21,6 +21,22 @@ insert into t1 values ('a'); select * from t1 where c1='b'; drop table t1; + +# +# Bug#41084 full-text index added to custom UCA collation not working +# +CREATE TABLE t1 ( + col1 varchar(100) character set utf8 collate utf8_test_ci +); +INSERT INTO t1 (col1) VALUES ('abcd'),('efgh'),('ijkl'); +ALTER TABLE t1 ADD FULLTEXT INDEX (col1); +SELECT * FROM t1 where match (col1) against ('abcd'); +SELECT * FROM t1 where match (col1) against ('abcd' IN BOOLEAN MODE); +ALTER TABLE t1 ADD (col2 varchar(100) character set latin1); +UPDATE t1 SET col2=col1; +SELECT * FROM t1 WHERE col1=col2 ORDER BY col1; +DROP TABLE t1; + # # Vietnamese experimental collation # diff --git a/mysys/charset.c b/mysys/charset.c index 9bd8de4316a9b9ad6ba54f762032712340a121f3..8f47b4027ef22b2724564552c49056870daa54e3 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -212,6 +212,8 @@ copy_uca_collation(CHARSET_INFO *to, CHARSET_INFO *from) to->max_sort_char= from->max_sort_char; to->mbminlen= from->mbminlen; to->mbmaxlen= from->mbmaxlen; + to->state|= MY_CS_AVAILABLE | MY_CS_LOADED | + MY_CS_STRNXFRM | MY_CS_UNICODE; } @@ -246,14 +248,12 @@ static int add_collation(CHARSET_INFO *cs) { #if defined(HAVE_CHARSET_ucs2) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, &my_charset_ucs2_unicode_ci); - newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif } else if (!strcmp(cs->csname, "utf8")) { #if defined (HAVE_CHARSET_utf8) && defined(HAVE_UCA_COLLATIONS) copy_uca_collation(newcs, &my_charset_utf8_unicode_ci); - newcs->state|= MY_CS_AVAILABLE | MY_CS_LOADED; #endif } else