summaryrefslogtreecommitdiff
path: root/sql/sql_derived.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-07-18 16:46:57 +0200
committerSergei Golubchik <sergii@pisem.net>2013-07-18 16:46:57 +0200
commit5f6380adde2dac3f32b40339b9b702c0135eb7d6 (patch)
tree31068acc0b39c208d35d524688a5985831af0447 /sql/sql_derived.cc
parent8a23ae088dc38f591efeab9eccdef5eb9094add9 (diff)
parent97e640b9ae83e07b444fceede6b0524256c7a3cc (diff)
downloadmariadb-git-5f6380adde2dac3f32b40339b9b702c0135eb7d6.tar.gz
10.0-base merge
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r--sql/sql_derived.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 526d2445d3d..2992bb0da6e 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -87,7 +87,16 @@ mysql_handle_derived(LEX *lex, uint phases)
sl && !res;
sl= sl->next_select_in_list())
{
- for (TABLE_LIST *cursor= sl->get_table_list();
+ TABLE_LIST *cursor= sl->get_table_list();
+ /*
+ DT_MERGE_FOR_INSERT is not needed for views/derived tables inside
+ subqueries. Views and derived tables of subqueries should be
+ processed normally.
+ */
+ if (phases == DT_MERGE_FOR_INSERT &&
+ cursor && cursor->top_table()->select_lex != &lex->select_lex)
+ continue;
+ for (;
cursor && !res;
cursor= cursor->next_local)
{
@@ -812,8 +821,7 @@ bool mysql_derived_create(THD *thd, LEX *lex, TABLE_LIST *derived)
result->tmp_table_param.start_recinfo,
&result->tmp_table_param.recinfo,
(unit->first_select()->options |
- thd->variables.option_bits | TMP_TABLE_ALL_COLUMNS),
- thd->variables.big_tables))
+ thd->variables.option_bits | TMP_TABLE_ALL_COLUMNS)))
return(TRUE);
}
if (open_tmp_table(table))