diff options
author | Norvald H. Ryeng <norvald.ryeng@oracle.com> | 2012-06-28 14:34:49 +0200 |
---|---|---|
committer | Norvald H. Ryeng <norvald.ryeng@oracle.com> | 2012-06-28 14:34:49 +0200 |
commit | 537f770633c9755528872abc02b011307e0563be (patch) | |
tree | b7d7333e18d65811eff8a2beb2dab77edfa9e0b2 /sql | |
parent | 78dce2d5c2e891151829724131953d14857f1167 (diff) | |
parent | 5f61cc438ba490a6de65733aa41c1b60f095a2f6 (diff) | |
download | mariadb-git-537f770633c9755528872abc02b011307e0563be.tar.gz |
Merge.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/sql_select.cc | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/sql/item.cc b/sql/item.cc index 90bfb0d2852..356fe4827c8 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6010,7 +6010,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) if (from_field != not_found_field) { Item_field* fld; - if (!(fld= new Item_field(from_field))) + if (!(fld= new Item_field(thd, last_checked_context, from_field))) goto error; thd->change_item_tree(reference, fld); mark_as_dependent(thd, last_checked_context->select_lex, diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7c3d2de22bc..f2007f609e0 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -528,6 +528,8 @@ JOIN::prepare(Item ***rref_pointer_array, if (having) { + Query_arena backup, *arena; + arena= thd->activate_stmt_arena_if_needed(&backup); nesting_map save_allow_sum_func= thd->lex->allow_sum_func; thd->where="having clause"; thd->lex->allow_sum_func|= 1 << select_lex_arg->nest_level; @@ -536,6 +538,10 @@ JOIN::prepare(Item ***rref_pointer_array, (having->fix_fields(thd, &having) || having->check_cols(1))); select_lex->having_fix_field= 0; + select_lex->having= having; + if (arena) + thd->restore_active_arena(arena, &backup); + if (having_fix_rc || thd->is_error()) DBUG_RETURN(-1); /* purecov: inspected */ thd->lex->allow_sum_func= save_allow_sum_func; |