summaryrefslogtreecommitdiff
path: root/sql/sql_union.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r--sql/sql_union.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index f8fe8b0be00..58601a178b7 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -930,7 +930,8 @@ bool st_select_lex_unit::exec()
if (executed && !uncacheable && !describe)
DBUG_RETURN(FALSE);
executed= 1;
- if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item)
+ if (!(uncacheable & ~UNCACHEABLE_EXPLAIN) && item &&
+ !item->with_recursive_reference)
item->make_const();
saved_error= optimize();
@@ -1263,6 +1264,12 @@ bool st_select_lex_unit::exec_recursive()
if (with_element->level == 1)
rec_table->reginfo.join_tab->preread_init_done= true;
}
+ for (Item_subselect *sq= with_element->sq_with_rec_ref.first;
+ sq;
+ sq= sq->next_with_rec_ref)
+ {
+ sq->engine->force_reexecution();
+ }
thd->lex->current_select= lex_select_save;
err: