From 425c5ecd7c9a878479763f3c1e90b889f1572414 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik <serg@mysql.com> Date: Mon, 19 Oct 2009 15:13:45 +0200 Subject: [PATCH] Bug#34374 mysql generates incorrect warning backport to next-mr --- mysql-test/r/fulltext.result | 8 ++++++++ mysql-test/t/fulltext.test | 9 +++++++++ sql/sql_select.cc | 12 ++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result index a5216189d9..abab18e0e9 100644 --- a/mysql-test/r/fulltext.result +++ b/mysql-test/r/fulltext.result @@ -494,6 +494,14 @@ SELECT a FROM t1 WHERE MATCH a AGAINST ('+city* of*' IN BOOLEAN MODE); a City Of God DROP TABLE t1; +create table t1(a text,b date,fulltext index(a))engine=myisam; +insert into t1 set a='water',b='2008-08-04'; +select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01'; +1 +1 +drop table t1; +show warnings; +Level Code Message CREATE TABLE t1 (a VARCHAR(255), b INT, FULLTEXT(a), KEY(b)); INSERT INTO t1 VALUES('test', 1),('test', 1),('test', 1),('test', 1), ('test', 1),('test', 2),('test', 3),('test', 4); diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test index 80c8658d35..dd7ebf2535 100644 --- a/mysql-test/t/fulltext.test +++ b/mysql-test/t/fulltext.test @@ -419,6 +419,15 @@ DROP TABLE t1; # End of 4.1 tests +# +# bug#34374 - mysql generates incorrect warning +# +create table t1(a text,b date,fulltext index(a))engine=myisam; +insert into t1 set a='water',b='2008-08-04'; +select 1 from t1 where match(a) against ('water' in boolean mode) and b>='2008-08-01'; +drop table t1; +show warnings; + # # BUG#38842 - Fix for 25951 seems incorrect # diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 2a937fb0ac..9d07deea9b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -3613,16 +3613,16 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array, Item_func *arg0=(Item_func *)(func->arguments()[0]), *arg1=(Item_func *)(func->arguments()[1]); if (arg1->const_item() && - ((functype == Item_func::GE_FUNC && arg1->val_real() > 0) || - (functype == Item_func::GT_FUNC && arg1->val_real() >=0)) && arg0->type() == Item::FUNC_ITEM && - arg0->functype() == Item_func::FT_FUNC) + arg0->functype() == Item_func::FT_FUNC && + ((functype == Item_func::GE_FUNC && arg1->val_real() > 0) || + (functype == Item_func::GT_FUNC && arg1->val_real() >=0))) cond_func=(Item_func_match *) arg0; else if (arg0->const_item() && - ((functype == Item_func::LE_FUNC && arg0->val_real() > 0) || - (functype == Item_func::LT_FUNC && arg0->val_real() >=0)) && arg1->type() == Item::FUNC_ITEM && - arg1->functype() == Item_func::FT_FUNC) + arg1->functype() == Item_func::FT_FUNC && + ((functype == Item_func::LE_FUNC && arg0->val_real() > 0) || + (functype == Item_func::LT_FUNC && arg0->val_real() >=0))) cond_func=(Item_func_match *) arg1; } } -- 2.30.9