#At file:///home/anurag/mysqlsrc/mysql-5.0-bugteam-45130/ based on revid:joro@stripped
2796 Anurag Shekhar 2009-08-27
Bug #45130 Incorrect results with multiple MATCH() against a table with
no fulltext indexes
When multiple MATCH is performed in one query (against a table
without fulltext index) the server is not distinguishing between
column sets for individual MATCH resulting in unexpected output of
the Match.
The problem was with Item_func_match::eq(). While checking for for key
it was considering all the columns in the serach set part of one key.
Changing this to treat individual columns fixed the problem.
@ mysql-test/r/fulltext.result
Updated results with added test case for 45130.
@ mysql-test/t/fulltext.test
Updated with test case for 45130.
@ sql/item_func.cc
Modified to skip if the item is unfixed and to use super class's eq
method except for comparing item flags.
modified:
mysql-test/r/fulltext.result
mysql-test/t/fulltext.test
sql/item_func.cc
=== modified file 'mysql-test/r/fulltext.result'
--- a/mysql-test/r/fulltext.result 2009-07-15 09:30:58 +0000
+++ b/mysql-test/r/fulltext.result 2009-08-27 09:20:58 +0000
@@ -518,3 +518,11 @@ EXECUTE s;
MATCH (col) AGAINST('findme')
DEALLOCATE PREPARE s;
DROP TABLE t1;
+CREATE TABLE t1(a TEXT, b BLOB);
+INSERT INTO t1 VALUES('TEST1','TEST1');
+SELECT MATCH(a) AGAINST('test1' IN BOOLEAN MODE), MATCH(b) AGAINST
+('test1' IN BOOLEAN MODE) FROM t1;
+MATCH(a) AGAINST('test1' IN BOOLEAN MODE) MATCH(b) AGAINST
+('test1' IN BOOLEAN MODE)
+1 0
+DROP TABLE t1;
=== modified file 'mysql-test/t/fulltext.test'
--- a/mysql-test/t/fulltext.test 2009-07-15 09:30:58 +0000
+++ b/mysql-test/t/fulltext.test 2009-08-27 09:20:58 +0000
@@ -455,3 +455,12 @@ EXECUTE s;
DEALLOCATE PREPARE s;
DROP TABLE t1;
+#
+#Bug #45130 Incorrect results with multiple MATCH() against a table with no fulltext indexes
+#
+
+CREATE TABLE t1(a TEXT, b BLOB);
+INSERT INTO t1 VALUES('TEST1','TEST1');
+SELECT MATCH(a) AGAINST('test1' IN BOOLEAN MODE), MATCH(b) AGAINST
+ ('test1' IN BOOLEAN MODE) FROM t1;
+DROP TABLE t1;
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2009-08-10 18:53:26 +0000
+++ b/sql/item_func.cc 2009-08-27 09:20:58 +0000
@@ -5148,18 +5148,13 @@ err:
bool Item_func_match::eq(const Item *item, bool binary_cmp) const
{
- if (item->type() != FUNC_ITEM ||
- ((Item_func*)item)->functype() != FT_FUNC ||
- flags != ((Item_func_match*)item)->flags)
- return 0;
-
- Item_func_match *ifm=(Item_func_match*) item;
-
- if (key == ifm->key && table == ifm->table &&
- key_item()->eq(ifm->key_item(), binary_cmp))
- return 1;
- return 0;
+ /*
+ Skip if unfixed.
+ Except for flags use the base class for all checks.
+ */
+ return fixed && Item_real_func::eq(item, binary_cmp) &&
+ (flags == ((Item_func_match*) item)->flags);
}
Attachment: [text/bzr-bundle] bzr/anurag.shekhar@sun.com-20090827092058-pcm9cqgqcobtprhb.bundle