Skip to content

Commit ca4d2ff

Browse files
Chaithra Gopalareddydahlerlend
authored andcommitted
Bug#32820437: FULLTEXT MATCH CRASHED THE SERVER
When a condition is pushed down to a materialized derived table, a clone of the derived table expression replaces the field (from the outer query block) in the condition. If this cloned item has a fulltext function, it needs to be added to the ftfunc_list in the derived table query block. However, while cloning, as the query block is not set to the derived table query block, the fulltext function gets added to the outer query block leading to problems later. Solution: We now use derived query block to clone an item. Change-Id: Id23e2bda8673e52a58805a48c6578aa1db5fc913
1 parent 215a4a7 commit ca4d2ff

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sql/sql_derived.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,10 @@ Item *TABLE_LIST::get_clone_for_derived_expr(THD *thd, Item *item,
562562
bool parsing_system_view_saved = thd->parsing_system_view;
563563
thd->parsing_system_view = is_system_view;
564564

565+
// Set the correct query block to parse the item. In some cases, like
566+
// fulltext functions, parser needs to add them to ftfunc_list of the
567+
// query block.
568+
thd->lex->set_current_query_block(context->query_block);
565569
bool result = parse_sql(thd, &parser_state, nullptr);
566570

567571
// End of parsing.

0 commit comments

Comments
 (0)