Commit 332be5bd authored by svoj@april.(none)'s avatar svoj@april.(none)

BUG#14496: Crash or strange results with prepared statement,

           MATCH and FULLTEXT
Fixed that fulltext query using PS results in unexpected behaviour
when executed 2 or more times.
parent 04d6b7fa
...@@ -436,3 +436,14 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); ...@@ -436,3 +436,14 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
a a
testword'' testword''
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
EXECUTE stmt;
a MATCH(a) AGAINST('test1 test')
test1 0.68526661396027
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
...@@ -357,4 +357,16 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE); ...@@ -357,4 +357,16 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE); SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
DROP TABLE t1; DROP TABLE t1;
#
# BUG#14496: Crash or strange results with prepared statement,
# MATCH and FULLTEXT
#
CREATE TABLE t1 (a TEXT, FULLTEXT KEY(a));
INSERT INTO t1 VALUES('test'),('test1'),('test');
PREPARE stmt from "SELECT a, MATCH(a) AGAINST('test1 test') FROM t1 WHERE MATCH(a) AGAINST('test1 test')";
EXECUTE stmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
DROP TABLE t1;
# End of 4.1 tests # End of 4.1 tests
...@@ -1056,7 +1056,6 @@ class Item_func_match :public Item_real_func ...@@ -1056,7 +1056,6 @@ class Item_func_match :public Item_real_func
if (!master && ft_handler) if (!master && ft_handler)
{ {
ft_handler->please->close_search(ft_handler); ft_handler->please->close_search(ft_handler);
ft_handler=0;
if (join_key) if (join_key)
table->file->ft_handler=0; table->file->ft_handler=0;
table->fulltext_searched=0; table->fulltext_searched=0;
...@@ -1066,6 +1065,7 @@ class Item_func_match :public Item_real_func ...@@ -1066,6 +1065,7 @@ class Item_func_match :public Item_real_func
delete concat; delete concat;
concat= 0; concat= 0;
} }
ft_handler= 0;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
enum Functype functype() const { return FT_FUNC; } enum Functype functype() const { return FT_FUNC; }
......
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