diff options
Diffstat (limited to 'sql/sql_union.cc')
-rw-r--r-- | sql/sql_union.cc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc index ece5a84b1c3..d5d43e56875 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1459,9 +1459,21 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg, if (sl->tvc->prepare(thd, sl, tmp_result, this)) goto err; } - else if (prepare_join(thd, first_sl, tmp_result, additional_options, + else + { + if (prepare_join(thd, first_sl, tmp_result, additional_options, is_union_select)) - goto err; + goto err; + + if (derived_arg && derived_arg->table && + derived_arg->derived_type == VIEW_ALGORITHM_MERGE && + derived_arg->table->versioned()) + { + /* Got versioning conditions (see vers_setup_conds()), need to update + derived_arg. */ + derived_arg->where= first_sl->where; + } + } types= first_sl->item_list; goto cont; } |