mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
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.
This commit is contained in:
parent
da44c30130
commit
9a64fc52af
3 changed files with 37 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
#
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue