bugfix: cmp_item_row::alloc_comparators() allocated on the wrong arena

it used current_thd->alloc() and allocated on the thd's execution arena,
not on table->expr_arena.

Remove THD::arena_for_cached_items that is temporarily set in
update_virtual_fields(), and replaces THD arena in get_datetime_value().
Instead set THD arena to table->expr_arena for the whole  duration
of update_virtual_fields()
This commit is contained in:
Sergei Golubchik 2017-01-14 20:55:33 +01:00
commit 798fcb5416
6 changed files with 20 additions and 34 deletions

View file

@ -921,12 +921,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg,
if (!thd)
thd= current_thd;
Query_arena backup;
Query_arena *save_arena= thd->switch_to_arena_for_cached_items(&backup);
Item_cache_temporal *cache= new Item_cache_temporal(f_type);
if (save_arena)
thd->set_query_arena(save_arena);
cache->store_packed(value, item);
*cache_arg= cache;
*item_arg= cache_arg;