Commit 89b1b508 authored by Neeraj Bisht's avatar Neeraj Bisht

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.


sql/item_func.cc:
  skiping execution, if item is not resolved.
parent 7c384a93
...@@ -5316,6 +5316,13 @@ void Item_func_match::init_search(bool no_order) ...@@ -5316,6 +5316,13 @@ void Item_func_match::init_search(bool no_order)
{ {
DBUG_ENTER("Item_func_match::init_search"); DBUG_ENTER("Item_func_match::init_search");
/*
We will skip execution if the item is not fixed
with fix_field
*/
if (!fixed)
DBUG_VOID_RETURN;
/* Check if init_search() has been called before */ /* Check if init_search() has been called before */
if (ft_handler) if (ft_handler)
{ {
...@@ -5446,6 +5453,13 @@ bool Item_func_match::fix_index() ...@@ -5446,6 +5453,13 @@ bool Item_func_match::fix_index()
uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts=0, keynr; uint ft_to_key[MAX_KEY], ft_cnt[MAX_KEY], fts=0, keynr;
uint max_cnt=0, mkeys=0, i; uint max_cnt=0, mkeys=0, i;
/*
We will skip execution if the item is not fixed
with fix_field
*/
if (!fixed)
return false;
if (key == NO_SUCH_KEY) if (key == NO_SUCH_KEY)
return 0; return 0;
......
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