diff --git a/myisam/sort.c b/myisam/sort.c index f2f8c8ef7ec..fabd713ef45 100644 --- a/myisam/sort.c +++ b/myisam/sort.c @@ -587,13 +587,15 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) while (!got_error && !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)&key_length, - sizeof(key_length)) && - !my_b_read(&sinfo->tempfile_for_exceptions,(byte*)mergebuf, - (uint) key_length)) + sizeof(key_length))) { - if (_mi_ck_write(info,sinfo->key,(uchar*) mergebuf, - key_length - info->s->rec_reflength)) - got_error=1; + byte ft_buf[HA_FT_MAXBYTELEN + HA_FT_WLEN + 10]; + if (key_length > sizeof(ft_buf) || + my_b_read(&sinfo->tempfile_for_exceptions, (byte*)ft_buf, + (uint)key_length) || + _mi_ck_write(info, sinfo->key, (uchar*)ft_buf, + key_length - info->s->rec_reflength)) + got_error=1; } } } diff --git a/mysql-test/r/ctype_big5.result b/mysql-test/r/ctype_big5.result index 8d2c39df853..01b59b93b52 100644 --- a/mysql-test/r/ctype_big5.result +++ b/mysql-test/r/ctype_big5.result @@ -128,3 +128,9 @@ SELECT * FROM t1; a ùØ DROP TABLE t1; +CREATE TABLE t1 (a CHAR(50) CHARACTER SET big5 NOT NULL, FULLTEXT(a)); +INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E); +SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE); +HEX(a) +A741ADCCA66EB6DC20A7DAADCCABDCA66E +DROP TABLE t1; diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index 1a79f6d9736..6a41035eb7b 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -422,3 +422,11 @@ SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabr COUNT(*) 1 DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)); +INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +SET myisam_repair_threads=2; +REPAIR TABLE t1; +Table Op Msg_type Msg_text +test.t1 repair status OK +SET myisam_repair_threads=@@global.myisam_repair_threads; +DROP TABLE t1; diff --git a/mysql-test/t/ctype_big5.test b/mysql-test/t/ctype_big5.test index e4fb1d2a32b..73d9f06042c 100644 --- a/mysql-test/t/ctype_big5.test +++ b/mysql-test/t/ctype_big5.test @@ -28,4 +28,12 @@ INSERT INTO t1 VALUES (' SELECT * FROM t1; DROP TABLE t1; +# +# BUG#12075 - FULLTEXT non-functional for big5 strings +# +CREATE TABLE t1 (a CHAR(50) CHARACTER SET big5 NOT NULL, FULLTEXT(a)); +INSERT INTO t1 VALUES(0xA741ADCCA66EB6DC20A7DAADCCABDCA66E); +SELECT HEX(a) FROM t1 WHERE MATCH(a) AGAINST (0xA741ADCCA66EB6DC IN BOOLEAN MODE); +DROP TABLE t1; + # End of 4.1 tests diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index b0b70d40e5c..300bea1c917 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -339,4 +339,15 @@ INSERT INTO t1 VALUES('Mit freundlichem Gr SELECT COUNT(*) FROM t1 WHERE MATCH(t) AGAINST ('"osnabrück"' IN BOOLEAN MODE); DROP TABLE t1; +# +# BUG#11684 - repair crashes mysql when table has fulltext index +# + +CREATE TABLE t1 (a VARCHAR(30), FULLTEXT(a)); +INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'); +SET myisam_repair_threads=2; +REPAIR TABLE t1; +SET myisam_repair_threads=@@global.myisam_repair_threads; +DROP TABLE t1; + # End of 4.1 tests diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e26b6a75b7c..b669a8c426d 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -2632,7 +2632,11 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, the temporary table, not the original field */ Field *field= (*field_item)->get_tmp_table_field(); - if (field) + /* + If field_item is a const item then either get_tp_table_field returns 0 + or it is an item over a const table. + */ + if (field && !(*field_item)->const_item()) { int res; uint offset= field->offset() - table->s->null_bytes; @@ -2666,8 +2670,11 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) the temporary table, not the original field */ Field *field= item->get_tmp_table_field(); - /* If the item is a constant, there is no tmp table field */ - if (field) + /* + If item is a const item then either get_tp_table_field returns 0 + or it is an item over a const table. + */ + if (field && !item->const_item()) { int res; uint offset= field->offset() - table->s->null_bytes; @@ -3037,7 +3044,6 @@ bool Item_func_group_concat::setup(THD *thd) DBUG_RETURN(TRUE); count_field_types(tmp_table_param,all_fields,0); - tmp_table_param->need_const= 1; DBUG_ASSERT(table == 0); /* We have to create a temporary table to get descriptions of fields diff --git a/sql/sql_class.h b/sql/sql_class.h index 90112bd650b..3043a87efc0 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1705,14 +1705,13 @@ public: bool using_indirect_summary_function; /* If >0 convert all blob fields to varchar(convert_blob_length) */ uint convert_blob_length; - bool need_const; /* <=> const items are saved in tmp table */ CHARSET_INFO *table_charset; bool schema_table; TMP_TABLE_PARAM() :copy_field(0), group_parts(0), - group_length(0), group_null_parts(0), convert_blob_length(0), - need_const(0), schema_table(0) + group_length(0), group_null_parts(0), convert_blob_length(0), + schema_table(0) {} ~TMP_TABLE_PARAM() { diff --git a/sql/sql_select.cc b/sql/sql_select.cc index bf5b0542917..c09a35c1fc0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8254,8 +8254,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List &fields, param->using_indirect_summary_function=1; continue; } - if (item->const_item() && (int) hidden_field_count <= 0 && - !param->need_const) + if (item->const_item() && (int) hidden_field_count <= 0) continue; // We don't have to store this } if (type == Item::SUM_FUNC_ITEM && !group && !save_sum_fields) diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index d311859907f..9ccbb149523 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -61,12 +61,12 @@ static uchar NEAR ctype_big5[257] = 2,2,2,2,2,2,2,2,2,2,2,16,16,16,16,32, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, + 3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0, }; static uchar NEAR to_lower_big5[]=