#At file:///home/bar/mysql-bzr/mysql-5.1-b41084/
2781 Alexander Barkov 2009-02-02
Bug#41084 full-text index added to custom UCA collation not working
Problem:
Custom UCA collations didn't set the MY_CS_STRNXFRM flag,
which resulted in "prefix_search" method instead of
the required "seq_search".
Problem2: (not metioned in the bug report)
Custom UCA collations didn't also set the MY_CS_UNICODE flag,
so an attempt to compare a column with a custom UCA collation
to another column with a non-Unicode character set led to
the "illegal mix of collation" error.
Fix:
the two missing flags was added into collation initialization.
Upgrade:
- All fulltext indexes with custom UCA collations should be rebuilt.
- Non-fulltext custom UCA indexes should likely be rebuild as well.
modified:
mysql-test/r/ctype_ldml.result
mysql-test/t/ctype_ldml.test
mysys/charset.c
=== modified file 'mysql-test/r/ctype_ldml.result'
--- a/mysql-test/r/ctype_ldml.result 2007-06-07 12:55:55 +0000
+++ b/mysql-test/r/ctype_ldml.result 2009-02-02 13:25:42 +0000
@@ -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
=== modified file 'mysql-test/t/ctype_ldml.test'
--- a/mysql-test/t/ctype_ldml.test 2007-06-07 12:55:55 +0000
+++ b/mysql-test/t/ctype_ldml.test 2009-02-02 13:25:42 +0000
@@ -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
#
=== modified file 'mysys/charset.c'
--- a/mysys/charset.c 2008-02-18 22:29:39 +0000
+++ b/mysys/charset.c 2009-02-02 13:25:42 +0000
@@ -212,6 +212,8 @@ copy_uca_collation(CHARSET_INFO *to, CHA
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 *c
{
#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
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (bar:2781) Bug#41084 | Alexander Barkov | 2 Feb 2009 |