Below is the list of changes that have just been committed into a local
5.0 repository of svoj. When svoj does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-04-02 17:26:39+05:00, svoj@stripped +4 -0
BUG#25729 - boolean full text search is confused by NULLs produced by
LEFT JOIN
Fixed that in certain situations MATCH ... AGAINST returns false hits
for NULLs produced by LEFT JOIN when there is no fulltext index
available.
mysql-test/r/fulltext_left_join.result@stripped, 2007-04-02 17:26:38+05:00, svoj@stripped
+7 -0
A test case for BUG#25729.
mysql-test/t/fulltext_left_join.test@stripped, 2007-04-02 17:26:38+05:00, svoj@stripped +11
-0
A test case for BUG#25729.
sql/item_func.cc@stripped, 2007-04-02 17:26:38+05:00, svoj@stripped +4 -4
concat_ws(NULL) returns empty string instead of NULL. There is not much
sense to calculate relevance for empty strings, thus return 0 immediately
if we got NULL or empty string from concat_ws.
sql/item_func.h@stripped, 2007-04-02 17:26:38+05:00, svoj@stripped +4 -4
Item_func_match::concat renamed to concat_ws.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: svoj
# Host: june.mysql.com
# Root: /home/svoj/devel/mysql/BUG25729/mysql-5.0-engines
--- 1.325/sql/item_func.cc 2007-01-29 21:36:10 +04:00
+++ 1.326/sql/item_func.cc 2007-04-02 17:26:38 +05:00
@@ -4597,14 +4597,14 @@ void Item_func_match::init_search(bool n
fields.push_back(new Item_string(" ",1, cmp_collation.collation));
for (uint i=1; i < arg_count; i++)
fields.push_back(args[i]);
- concat=new Item_func_concat_ws(fields);
+ concat_ws=new Item_func_concat_ws(fields);
/*
Above function used only to get value and do not need fix_fields for it:
Item_string - basic constant
fields - fix_fields() was already called for this arguments
Item_func_concat_ws - do not need fix_fields() to produce value
*/
- concat->quick_fix_field();
+ concat_ws->quick_fix_field();
}
if (master)
@@ -4819,8 +4819,8 @@ double Item_func_match::val_real()
if (key == NO_SUCH_KEY)
{
- String *a= concat->val_str(&value);
- if ((null_value= (a == 0)))
+ String *a= concat_ws->val_str(&value);
+ if ((null_value= (a == 0)) || !a->length())
DBUG_RETURN(0);
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
(byte *)a->ptr(), a->length()));
--- 1.160/sql/item_func.h 2007-01-10 00:23:37 +04:00
+++ 1.161/sql/item_func.h 2007-04-02 17:26:38 +05:00
@@ -1308,12 +1308,12 @@ public:
FT_INFO *ft_handler;
TABLE *table;
Item_func_match *master; // for master-slave optimization
- Item *concat; // Item_func_concat_ws
- String value; // value of concat
+ Item *concat_ws; // Item_func_concat_ws
+ String value; // value of concat_ws
String search_value; // key_item()'s value converted to cmp_collation
Item_func_match(List<Item> &a, uint b): Item_real_func(a), key(0), flags(b),
- join_key(0), ft_handler(0), table(0), master(0), concat(0) { }
+ join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { }
void cleanup()
{
DBUG_ENTER("Item_func_match");
@@ -1321,7 +1321,7 @@ public:
if (!master && ft_handler)
ft_handler->please->close_search(ft_handler);
ft_handler= 0;
- concat= 0;
+ concat_ws= 0;
DBUG_VOID_RETURN;
}
enum Functype functype() const { return FT_FUNC; }
--- 1.14/mysql-test/r/fulltext_left_join.result 2007-01-23 21:56:03 +04:00
+++ 1.15/mysql-test/r/fulltext_left_join.result 2007-04-02 17:26:38 +05:00
@@ -90,3 +90,10 @@ id link name relevance
1 1 string 0
2 0 string 0
DROP TABLE t1,t2;
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c TEXT, KEY(b));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+a b c
+DROP TABLE t1, t2;
--- 1.15/mysql-test/t/fulltext_left_join.test 2007-01-23 22:11:52 +04:00
+++ 1.16/mysql-test/t/fulltext_left_join.test 2007-04-02 17:26:38 +05:00
@@ -87,3 +87,14 @@ SELECT t1.*, MATCH(t1.name) AGAINST('str
DROP TABLE t1,t2;
# End of 4.1 tests
+
+#
+# BUG#25729 - boolean full text search is confused by NULLs produced by LEFT
+# JOIN
+#
+CREATE TABLE t1 (a INT);
+CREATE TABLE t2 (b INT, c TEXT, KEY(b));
+INSERT INTO t1 VALUES(1);
+INSERT INTO t2(b,c) VALUES(2,'castle'),(3,'castle');
+SELECT * FROM t1 LEFT JOIN t2 ON a=b WHERE MATCH(c) AGAINST('+castle' IN BOOLEAN MODE);
+DROP TABLE t1, t2;
| Thread |
|---|
| • bk commit into 5.0 tree (svoj:1.2396) BUG#25729 | Sergey Vojtovich | 2 Apr |