summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2005-08-07 11:03:54 +0000
committerunknown <sergefp@mysql.com>2005-08-07 11:03:54 +0000
commitf3ce475dcec23a51cff93aaa1bbaa27eba978b05 (patch)
tree418be3169a67dfe101f87edef1ffee62e1c08a2e
parent2b41471429d9db41d64bfb214e29ba57cb3db381 (diff)
parent852dcb75973a612ef5c28645018551ed7bd0055c (diff)
downloadmariadb-git-f3ce475dcec23a51cff93aaa1bbaa27eba978b05.tar.gz
Manual merge
mysql-test/t/fulltext_order_by.test: Auto merged sql/sql_select.cc: Auto merged sql/sql_union.cc: Auto merged
-rw-r--r--mysql-test/r/fulltext_order_by.result12
-rw-r--r--mysql-test/t/fulltext_order_by.test11
-rw-r--r--sql/mysql_priv.h5
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/sql_union.cc16
5 files changed, 40 insertions, 6 deletions
diff --git a/mysql-test/r/fulltext_order_by.result b/mysql-test/r/fulltext_order_by.result
index 3b52be4b1f2..5f40e43f0c0 100644
--- a/mysql-test/r/fulltext_order_by.result
+++ b/mysql-test/r/fulltext_order_by.result
@@ -158,5 +158,15 @@ where
match(c.beitrag) against ('+abc' in boolean mode)
order by
match(betreff) against ('+abc' in boolean mode) desc;
-ERROR HY000: The used table type doesn't support FULLTEXT indexes
+text id betreff
+(select b.id, b.betreff from t3 b) union
+(select b.id, b.betreff from t3 b)
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id betreff
+select distinct b.id, b.betreff from t3 b
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id betreff
+select b.id, b.betreff from t3 b group by b.id+1
+order by match(betreff) against ('+abc' in boolean mode) desc;
+id betreff
drop table t1,t2,t3;
diff --git a/mysql-test/t/fulltext_order_by.test b/mysql-test/t/fulltext_order_by.test
index a0bd7954674..5bad8161a0a 100644
--- a/mysql-test/t/fulltext_order_by.test
+++ b/mysql-test/t/fulltext_order_by.test
@@ -135,6 +135,17 @@ where
order by
match(betreff) against ('+abc' in boolean mode) desc;
+# BUG#11869 part2: used table type doesn't support FULLTEXT indexes error
+(select b.id, b.betreff from t3 b) union
+(select b.id, b.betreff from t3 b)
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
+select distinct b.id, b.betreff from t3 b
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
+select b.id, b.betreff from t3 b group by b.id+1
+order by match(betreff) against ('+abc' in boolean mode) desc;
+
drop table t1,t2,t3;
# End of 4.1 tests
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index c56496c394d..20898a4b654 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -284,6 +284,11 @@ extern CHARSET_INFO *national_charset_info, *table_alias_charset;
#define OPTION_SETUP_TABLES_DONE (1L << 30) // intern
/* If not set then the thread will ignore all warnings with level notes. */
#define OPTION_SQL_NOTES (1L << 31) // THD, user
+/*
+ Force the used temporary table to be a MyISAM table (because we will use
+ fulltext functions when reading from it.
+*/
+#define TMP_TABLE_FORCE_MYISAM (1L << 30)
/*
Maximum length of time zone name that we support
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index c09a35c1fc0..3f2f72fb768 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -8359,7 +8359,7 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
/* If result table is small; use a heap */
if (blob_count || using_unique_constraint ||
(select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) ==
- OPTION_BIG_TABLES)
+ OPTION_BIG_TABLES ||(select_options & TMP_TABLE_FORCE_MYISAM))
{
table->file=get_new_handler(table,table->s->db_type= DB_TYPE_MYISAM);
if (group &&
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index f2b637dc5f4..55c2524ca42 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -295,15 +295,23 @@ bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
goto err;
}
}
+
+ ulong create_options= first_select_in_union()->options | thd_arg->options |
+ TMP_TABLE_ALL_COLUMNS;
+ /*
+ Force the temporary table to be a MyISAM table if we're going to use
+ fullext functions (MATCH ... AGAINST .. IN BOOLEAN MODE) when reading
+ from it.
+ */
+ if (global_parameters->ftfunc_list->elements)
+ create_options= create_options | TMP_TABLE_FORCE_MYISAM;
union_result->tmp_table_param.field_count= types.elements;
if (!(table= create_tmp_table(thd_arg,
&union_result->tmp_table_param, types,
(ORDER*) 0, (bool) union_distinct, 1,
- (first_select_in_union()->options |
- thd_arg->options |
- TMP_TABLE_ALL_COLUMNS),
- HA_POS_ERROR, (char *) tmp_table_alias)))
+ create_options, HA_POS_ERROR,
+ (char *) tmp_table_alias)))
goto err;
table->file->extra(HA_EXTRA_WRITE_CACHE);
table->file->extra(HA_EXTRA_IGNORE_DUP_KEY);