From 8aaf987684f79e94c773cc4f5809493720c65073 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 23 Jan 2006 17:15:33 +0400 Subject: BUG#16489 - utf8 + fulltext leads to corrupt index file. Fixed that UPDATE statement crashes multi-byte charset fulltext index. myisam/ft_update.c: Fixed that UPDATE statement crashes multi-byte charset fulltext index. While updating, always rewrite multi-byte charset fulltext index. mysql-test/r/fulltext2.result: Added a testcase for BUG#16489. mysql-test/t/fulltext2.test: Added a testcase for BUG#16489. --- myisam/ft_update.c | 4 ++++ mysql-test/r/fulltext2.result | 5 +++++ mysql-test/t/fulltext2.test | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/myisam/ft_update.c b/myisam/ft_update.c index beccc062270..8f2b2bce101 100644 --- a/myisam/ft_update.c +++ b/myisam/ft_update.c @@ -170,6 +170,10 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2) FT_SEG_ITERATOR ftsi1, ftsi2; CHARSET_INFO *cs=info->s->keyinfo[keynr].seg->charset; DBUG_ENTER("_mi_ft_cmp"); +#ifndef MYSQL_HAS_TRUE_CTYPE_IMPLEMENTATION + if (cs->mbmaxlen > 1) + DBUG_RETURN(THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT); +#endif _mi_ft_segiterator_init(info, keynr, rec1, &ftsi1); _mi_ft_segiterator_init(info, keynr, rec2, &ftsi2); diff --git a/mysql-test/r/fulltext2.result b/mysql-test/r/fulltext2.result index 72c6b2d22ed..f6a4b20bc22 100644 --- a/mysql-test/r/fulltext2.result +++ b/mysql-test/r/fulltext2.result @@ -234,5 +234,10 @@ insert into t1 values('test test '),('test'),('test'),('test'), ('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), ('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'); delete from t1 limit 1; +truncate table t1; +insert into t1 values('ab c d'); +update t1 set a='ab c d'; +select * from t1 where match a against('ab c' in boolean mode); +a drop table t1; set names latin1; diff --git a/mysql-test/t/fulltext2.test b/mysql-test/t/fulltext2.test index 7a7b572d58f..fd97f795534 100644 --- a/mysql-test/t/fulltext2.test +++ b/mysql-test/t/fulltext2.test @@ -209,6 +209,14 @@ insert into t1 values('test test '),('test'),('test'),('test'), ('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'), ('test'),('test'),('test'),('test'),('test'),('test'),('test'),('test'); delete from t1 limit 1; + +# +# BUG#16489: utf8 + fulltext leads to corrupt index file. +# +truncate table t1; +insert into t1 values('ab c d'); +update t1 set a='ab c d'; +select * from t1 where match a against('ab c' in boolean mode); drop table t1; set names latin1; -- cgit v1.2.1