Skip to content

Commit f92dd6a

Browse files
committed
Bug #20007383: HANDLE_FATAL_SIGNAL (SIG=11) IN UPDATE_REF_AND_KEYS.
Issue: ====== The fulltext predicate is inside a subquery and involves an outer reference; it thus cannot be used for FT index look-up, but MySQL does not see it, which causes a illegal access. Solution: ========= Solution is backported from bug#21140088. Outer reference can not be used as argument of the MATCH function. Added check for outer reference.
1 parent ecfc7c2 commit f92dd6a

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

mysql-test/r/fulltext.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
541541
DROP TABLE t1;
542542
CREATE TABLE t1(a TEXT);
543543
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
544-
ERROR HY000: Incorrect arguments to AGAINST
544+
ERROR HY000: Incorrect arguments to MATCH
545545
DROP TABLE t1;
546546
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
547547
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');

sql/item_func.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -5900,12 +5900,12 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
59005900
const_item_cache=0;
59015901
for (uint i=1 ; i < arg_count ; i++)
59025902
{
5903-
item=args[i];
5904-
if (item->type() == Item::REF_ITEM)
5905-
args[i]= item= *((Item_ref *)item)->ref;
5906-
if (item->type() != Item::FIELD_ITEM)
5903+
item= args[i]= args[i]->real_item();
5904+
if (item->type() != Item::FIELD_ITEM ||
5905+
/* Cannot use FTS index with outer table field */
5906+
(item->used_tables() & OUTER_REF_TABLE_BIT))
59075907
{
5908-
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST");
5908+
my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
59095909
return TRUE;
59105910
}
59115911
}

0 commit comments

Comments
 (0)