Commit 6293e3bb authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-14743: Server crashes in Item_func_match::init_search

Remove non prepared (and so belonging to removed clauses FT functions) from the list.

in later version it will be fixed by building the list during preparation.
parent 5ea28015
......@@ -742,5 +742,25 @@ txt1 txt2
nnn2 x2 y2 ööö2 mmm2 ùùù2
DROP TABLE t1;
#
# MDEV-14743: Server crashes in Item_func_match::init_search
#
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) )
1
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
f1 f2
1 0
1 0
explain extended
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 100.00
2 SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
Warnings:
Note 1003 select <expr_cache><'foo'>(<in_optimizer>('foo',<exists>(select `test`.`t1`.`f` from `test`.`t1` where ((<cache>(convert('foo' using latin1)) = `test`.`t1`.`f`) or isnull(`test`.`t1`.`f`)) having <is_not_null_test>(`test`.`t1`.`f`)))) AS `f1`,(match `test`.`t1`.`f` against ('qux' in boolean mode)) AS `f2` from `test`.`t1`
drop table t1;
#
# End of 5.5 tests
#
......@@ -682,6 +682,21 @@ SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ööö1' IN BOOLEAN MODE);
SELECT * FROM t1 WHERE MATCH (txt1,txt2) AGAINST ('ùùù2' IN BOOLEAN MODE);
DROP TABLE t1;
--echo #
--echo # MDEV-14743: Server crashes in Item_func_match::init_search
--echo #
CREATE TABLE t1 (f VARCHAR(8));
INSERT INTO t1 VALUES ('foo'),('bar');
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) );
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
explain extended
SELECT 'foo' IN ( SELECT f FROM t1 GROUP BY MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE )) as f1, MATCH(f) AGAINST ( 'qux' IN BOOLEAN MODE ) as f2 from t1 ;
drop table t1;
--echo #
--echo # End of 5.5 tests
--echo #
......@@ -9550,7 +9550,17 @@ int init_ftfuncs(THD *thd, SELECT_LEX *select_lex, bool no_order)
DBUG_PRINT("info",("Performing FULLTEXT search"));
while ((ifm=li++))
ifm->init_search(no_order);
#if MYSQL_VERSION_ID < 100213
if (unlikely(!ifm->fixed))
/*
it mean that clause where was FT function was removed, so we have
to remove the function from the list.
*/
li.remove();
else
#endif
ifm->init_search(no_order);
}
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