summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2002-03-01 16:57:08 +0000
committerunknown <serg@serg.mysql.com>2002-03-01 16:57:08 +0000
commit43a1ef6ce23e8751236c3948030e6e7b57bd5c45 (patch)
tree2b4289848a910e2a05a4d815949eaca3ecf90bb8
parent6fdd6e8e4689342f8fa213a36465d2263a8ccab9 (diff)
downloadmariadb-git-43a1ef6ce23e8751236c3948030e6e7b57bd5c45.tar.gz
fulltext+const_table bug fixed
mysql-test/r/fulltext.result: test added mysql-test/t/fulltext.test: test added sql/item_func.cc: fulltext+const_table problem fixed once and forever sql/item_func.h: fulltext+const_table problem fixed once and forever sql/sql_select.cc: fulltext+const_table problem fixed once and forever sql/table.h: fulltext+const_table problem fixed once and forever
-rw-r--r--mysql-test/r/fulltext.result6
-rw-r--r--mysql-test/t/fulltext.test10
-rw-r--r--sql/item_func.cc1
-rw-r--r--sql/item_func.h1
-rw-r--r--sql/sql_select.cc3
-rw-r--r--sql/table.h1
6 files changed, 21 insertions, 1 deletions
diff --git a/mysql-test/r/fulltext.result b/mysql-test/r/fulltext.result
index 1d03dffa76a..775ec29917f 100644
--- a/mysql-test/r/fulltext.result
+++ b/mysql-test/r/fulltext.result
@@ -150,3 +150,9 @@ select * from t1;
id title
1 this test once revealed a bug
update t1 set title=NULL where id=1;
+drop table t1;
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
+insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
+SELECT * from t1 where MATCH (b) AGAINST ('apples');
+a b
+drop table t1;
diff --git a/mysql-test/t/fulltext.test b/mysql-test/t/fulltext.test
index ace51217bba..3d203bc61f5 100644
--- a/mysql-test/t/fulltext.test
+++ b/mysql-test/t/fulltext.test
@@ -129,3 +129,13 @@ check table t1;
update t1 set title='this test once revealed a bug' where id=1;
select * from t1;
update t1 set title=NULL where id=1;
+
+drop table t1;
+
+# one more bug - const_table related
+
+CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
+insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
+SELECT * from t1 where MATCH (b) AGAINST ('apples');
+
+drop table t1;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 1818a755a43..01b3e4e89c4 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2108,6 +2108,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
key=NO_SUCH_KEY;
const_item_cache=0;
table=((Item_field *)fields.head())->field->table;
+ table->fulltext_searched=1;
record=table->record[0];
if (key == NO_SUCH_KEY && mode != FT_BOOL)
{
diff --git a/sql/item_func.h b/sql/item_func.h
index 823bfb44a96..3ef50340d98 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -930,6 +930,7 @@ public:
ft_handler=0;
if(join_key)
table->file->ft_handler=0;
+ table->fulltext_searched=0;
}
if (concat) delete concat;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ae6c38a874e..2078ffcf001 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -982,7 +982,8 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds,
s->dependent=(table_map) 0;
s->key_dependent=(table_map) 0;
if ((table->system || table->file->records <= 1) && ! s->dependent &&
- !(table->file->option_flag() & HA_NOT_EXACT_COUNT))
+ !(table->file->option_flag() & HA_NOT_EXACT_COUNT) &&
+ !table->fulltext_searched)
{
set_position(join,const_count++,s,(KEYUSE*) 0);
}
diff --git a/sql/table.h b/sql/table.h
index 259c34030b2..606087ae3ac 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -95,6 +95,7 @@ struct st_table {
my_bool db_low_byte_first; /* Portable row format */
my_bool locked_by_flush;
my_bool locked_by_name;
+ my_bool fulltext_searched;
my_bool crashed;
my_bool is_view;
my_bool no_keyread;