Skip to content

Commit c066c30

Browse files
author
Neeraj Bisht
committed
Bug#16073689 : CRASH IN ITEM_FUNC_MATCH::INIT_SEARCH
Problem: In query like select 1 from .. order by match .. against ...; causes a debug assert failue. Analysis: In union type query like (select * from order by a) order by b; or (select * from order by a) union (select * from order by b); We skip resolving of order by a for 1st query and order by of a and b in 2nd query. This means that, in case when our order by have Item_func_match class, we skip resolving it. But we maintain a ft_func_list and at the time of optimization, when we Perform FULLTEXT search before all regular searches on the bases of the list we call Item_func_match::init_search() which will cause debug assert as the item is not resolved. Solution: We will skip execution if the item is not fixed and we will not fix index(Item_func_match::fix_index()) for which Item_func_match::fix_field() is not called so that on later changes we can check the dependency on fix field.
1 parent 1ac26c5 commit c066c30

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

sql/item_func.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5316,6 +5316,13 @@ void Item_func_match::init_search(bool no_order)
53165316
{
53175317
DBUG_ENTER("Item_func_match::init_search");
53185318

5319+
/*
5320+
We will skip execution if the item is not fixed
5321+
with fix_field
5322+
*/
5323+
if (!fixed)
5324+
DBUG_VOID_RETURN;
5325+
53195326
/* Check if init_search() has been called before */
53205327
if (ft_handler)
53215328
{
@@ -5446,6 +5453,13 @@ bool Item_func_match::fix_index()
54465453
uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts=0, keynr;
54475454
uint max_cnt=0, mkeys=0, i;
54485455

5456+
/*
5457+
We will skip execution if the item is not fixed
5458+
with fix_field
5459+
*/
5460+
if (!fixed)
5461+
return false;
5462+
54495463
if (key == NO_SUCH_KEY)
54505464
return 0;
54515465

0 commit comments

Comments
 (0)