summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_cte.cc8
-rw-r--r--sql/sql_union.cc4
2 files changed, 8 insertions, 4 deletions
diff --git a/sql/sql_cte.cc b/sql/sql_cte.cc
index 7e60a8d1892..ffc54f50af1 100644
--- a/sql/sql_cte.cc
+++ b/sql/sql_cte.cc
@@ -330,8 +330,10 @@ With_element *With_clause::find_table_def(TABLE_LIST *table)
with_elem != NULL;
with_elem= with_elem->next_elem)
{
- if (my_strcasecmp(system_charset_info, with_elem->query_name->str, table->table_name) == 0)
+ if (my_strcasecmp(system_charset_info, with_elem->query_name->str,
+ table->table_name) == 0)
{
+ table->set_derived();
return with_elem;
}
}
@@ -740,6 +742,8 @@ bool st_select_lex::check_unrestricted_recursive()
encountered))
return true;
with_elem->owner->unrestricted|= unrestricted;
+ if (with_sum_func)
+ with_elem->owner->unrestricted|= with_elem->mutually_recursive;
return false;
}
@@ -813,7 +817,7 @@ bool With_element::check_unrestricted_recursive(st_select_lex *sel,
{
if (tab->outer_join & (JOIN_TYPE_LEFT | JOIN_TYPE_RIGHT))
{
- unrestricted|= get_elem_map();
+ unrestricted|= mutually_recursive;
break;
}
}
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 902620aaac1..9308dc2a841 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -205,13 +205,13 @@ select_union_recursive::create_result_table(THD *thd_arg,
{
if (select_union::create_result_table(thd_arg, column_types,
is_union_distinct, options,
- alias, bit_fields_as_long,
+ "", bit_fields_as_long,
create_table, keep_row_order))
return true;
if (! (incr_table= create_tmp_table(thd_arg, &tmp_table_param, *column_types,
(ORDER*) 0, false, 1,
- options, HA_POS_ERROR, alias,
+ options, HA_POS_ERROR, "",
!create_table, keep_row_order)))
return true;