Commit 8772f17c authored by unknown's avatar unknown

Bug #4769 - ft in subqueries

parent 35fe2dc6
...@@ -1899,3 +1899,16 @@ select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL ( ...@@ -1899,3 +1899,16 @@ select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (
a C a C
1 1 1 1
drop table t1,t2; drop table t1,t2;
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
create table t2 (a int);
insert into t2 values (1),(3),(2),(7);
select a,b from t1 where match(b) against ('Ball') > 0;
a b
1 ball
2 ball games
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
a
1
2
drop table t1,t2;
...@@ -1222,3 +1222,16 @@ CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=M ...@@ -1222,3 +1222,16 @@ CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=M
insert into t2 values (1,2); insert into t2 values (1,2);
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1); select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
drop table t1,t2; drop table t1,t2;
#
# BUG#4769 - fulltext in subselect
#
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
create table t2 (a int);
insert into t2 values (1),(3),(2),(7);
select a,b from t1 where match(b) against ('Ball') > 0;
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
drop table t1,t2;
...@@ -729,6 +729,10 @@ JOIN::optimize() ...@@ -729,6 +729,10 @@ JOIN::optimize()
(select_lex->ftfunc_list->elements ? (select_lex->ftfunc_list->elements ?
SELECT_NO_JOIN_CACHE : 0)); SELECT_NO_JOIN_CACHE : 0));
/* Perform FULLTEXT search before all regular searches */
if (!(select_options & SELECT_DESCRIBE))
init_ftfuncs(thd, select_lex, test(order));
/* /*
is this simple IN subquery? is this simple IN subquery?
*/ */
...@@ -849,8 +853,6 @@ JOIN::optimize() ...@@ -849,8 +853,6 @@ JOIN::optimize()
} }
having= 0; having= 0;
/* Perform FULLTEXT search before all regular searches */
init_ftfuncs(thd, select_lex, test(order));
/* Create a tmp table if distinct or if the sort is too complicated */ /* Create a tmp table if distinct or if the sort is too complicated */
if (need_tmp) if (need_tmp)
{ {
......
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