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.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 0be554f58a2..e0e8f8d42c5 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -313,24 +313,24 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
We're in statement prepare or in execution
of a conventional statement.
*/
- Item_arena backup;
- if (arena->is_stmt_prepare())
- thd->set_n_backup_item_arena(arena, &backup);
+ Item_arena *tmp_arena,backup;
+ tmp_arena= thd->change_arena_if_needed(&backup);
+
Field **field;
for (field= table->field; *field; field++)
{
Item_field *item= new Item_field(*field);
if (!item || item_list.push_back(item))
{
- if (arena->is_stmt_prepare())
- thd->restore_backup_item_arena(arena, &backup);
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
DBUG_RETURN(-1);
}
}
+ if (tmp_arena)
+ thd->restore_backup_item_arena(tmp_arena, &backup);
if (arena->is_stmt_prepare())
{
- thd->restore_backup_item_arena(arena, &backup);
-
/* prepare fake select to initialize it correctly */
ulong options_tmp= init_prepare_fake_select_lex(thd);
if (!(fake_select_lex->join= new JOIN(thd, item_list, thd->options,