diff options
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 337b1d5e02a..a685c948a3d 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1980,7 +1980,20 @@ JOIN::optimize_inner() } } - conds= optimize_cond(this, conds, join_list, FALSE, + bool ignore_on_expr= false; + /* + PS/SP note: on_expr of versioned table can not be reallocated + (see build_equal_items() below) because it can be not rebuilt + at second invocation. + */ + if (!thd->stmt_arena->is_conventional() && thd->mem_root != thd->stmt_arena->mem_root) + for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local) + if (tbl->table && tbl->on_expr && tbl->table->versioned()) + { + ignore_on_expr= true; + break; + } + conds= optimize_cond(this, conds, join_list, ignore_on_expr, &cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS); if (thd->is_error()) @@ -18488,7 +18501,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields, /* Test if there is a default field value. The test for ->ptr is to skip - 'offset' fields generated by initalize_tables + 'offset' fields generated by initialize_tables */ if (default_field[i] && default_field[i]->ptr) { @@ -21265,7 +21278,7 @@ join_read_last(JOIN_TAB *tab) { TABLE *table=tab->table; int error= 0; - DBUG_ENTER("join_read_first"); + DBUG_ENTER("join_read_last"); DBUG_ASSERT(table->no_keyread || !table->covering_keys.is_set(tab->index) || |