Commit 29868de2 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9986 Full-text search of the utf8mb4 column causes crash

take into account that agg_arg_charsets_for_comparison()
can replace Item_field's with Item_func_conv_charset
parent 7f5ceb77
...@@ -15,3 +15,15 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci, ...@@ -15,3 +15,15 @@ CREATE TABLE t1(a VARCHAR(2) CHARACTER SET big5 COLLATE big5_chinese_ci,
FULLTEXT(a)); FULLTEXT(a));
INSERT INTO t1 VALUES(0xA3C2); INSERT INTO t1 VALUES(0xA3C2);
DROP TABLE t1; DROP TABLE t1;
create table t1 (
id varchar(255),
business_name text null collate utf8mb4_unicode_ci,
street_address text,
fulltext index ft (business_name),
fulltext index ft2 (street_address)
);
select * from t1 where match (business_name, street_address) against ('some business name and address here');
ERROR HY000: Can't find FULLTEXT index matching the column list
select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode);
id business_name street_address
drop table t1;
...@@ -32,3 +32,18 @@ INSERT INTO t1 VALUES(0xA3C2); ...@@ -32,3 +32,18 @@ INSERT INTO t1 VALUES(0xA3C2);
DROP TABLE t1; DROP TABLE t1;
# End of 5.1 tests # End of 5.1 tests
#
# MDEV-9986 Full-text search of the utf8mb4 column causes crash
#
create table t1 (
id varchar(255),
business_name text null collate utf8mb4_unicode_ci,
street_address text,
fulltext index ft (business_name),
fulltext index ft2 (street_address)
);
--error ER_FT_MATCHING_KEY_NOT_FOUND
select * from t1 where match (business_name, street_address) against ('some business name and address here');
select * from t1 where match (business_name, street_address) against ('some business name and address here' in boolean mode);
drop table t1;
...@@ -6366,6 +6366,8 @@ bool Item_func_match::fix_index() ...@@ -6366,6 +6366,8 @@ bool Item_func_match::fix_index()
for (i=1; i < arg_count; i++) for (i=1; i < arg_count; i++)
{ {
if (args[i]->type() != FIELD_ITEM)
goto err;
item=(Item_field*)args[i]; item=(Item_field*)args[i];
for (keynr=0 ; keynr < fts ; keynr++) for (keynr=0 ; keynr < fts ; keynr++)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment