Commit f92dd6ae authored by Mithun C Y's avatar Mithun C Y

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.
parent ecfc7c26
...@@ -541,7 +541,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE) ...@@ -541,7 +541,7 @@ MATCH(a) AGAINST('aaa1* aaa14 aaa15 aaa16' IN BOOLEAN MODE)
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a TEXT); CREATE TABLE t1(a TEXT);
SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE); SELECT GROUP_CONCAT(a) AS st FROM t1 HAVING MATCH(st) AGAINST('test' IN BOOLEAN MODE);
ERROR HY000: Incorrect arguments to AGAINST ERROR HY000: Incorrect arguments to MATCH
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a)); CREATE TABLE t1(a VARCHAR(64), FULLTEXT(a));
INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd'); INSERT INTO t1 VALUES('awrd bwrd cwrd'),('awrd bwrd cwrd'),('awrd bwrd cwrd');
......
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. /* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by 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) ...@@ -5900,12 +5900,12 @@ bool Item_func_match::fix_fields(THD *thd, Item **ref)
const_item_cache=0; const_item_cache=0;
for (uint i=1 ; i < arg_count ; i++) for (uint i=1 ; i < arg_count ; i++)
{ {
item=args[i]; item= args[i]= args[i]->real_item();
if (item->type() == Item::REF_ITEM) if (item->type() != Item::FIELD_ITEM ||
args[i]= item= *((Item_ref *)item)->ref; /* Cannot use FTS index with outer table field */
if (item->type() != Item::FIELD_ITEM) (item->used_tables() & OUTER_REF_TABLE_BIT))
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "AGAINST"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "MATCH");
return TRUE; return TRUE;
} }
} }
......
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