Commit e3c30863 authored by unknown's avatar unknown
Browse files

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.


mysql-test/r/fulltext.result:
  Testcase for BUG#14496.
mysql-test/t/fulltext.test:
  Testcase for BUG#14496.
sql/item_func.h:
  In Item_func_match::cleanup() always reset ft_handler to 0.
parent c98077d6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -436,3 +436,14 @@ SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
a
testword''
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;
+12 −0
Original line number Diff line number Diff line
@@ -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);
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
+1 −1
Original line number Diff line number Diff line
@@ -1056,7 +1056,6 @@ class Item_func_match :public Item_real_func
    if (!master && ft_handler)
    {
      ft_handler->please->close_search(ft_handler);
      ft_handler=0;
      if (join_key)
	table->file->ft_handler=0;
      table->fulltext_searched=0;
@@ -1066,6 +1065,7 @@ class Item_func_match :public Item_real_func
      delete concat;
      concat= 0;
    }
    ft_handler= 0;
    DBUG_VOID_RETURN;
  }
  enum Functype functype() const { return FT_FUNC; }