summaryrefslogtreecommitdiffstats
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index bbd09a59..bcaf229d 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1296,9 +1296,14 @@ void Item_sum_min_max::setup_hybrid(THD *thd, Item *item, Item *value_arg)
/* Don't cache value, as it will change */
if (!item->const_item())
arg_cache->set_used_tables(RAND_TABLE_BIT);
+ DBUG_ASSERT(item->type_handler_for_comparison() ==
+ value->type_handler_for_comparison());
+ DBUG_ASSERT(item->type_handler_for_comparison() ==
+ arg_cache->type_handler_for_comparison());
cmp= new (thd->mem_root) Arg_comparator();
if (cmp)
- cmp->set_cmp_func(thd, this, (Item**)&arg_cache, (Item**)&value, FALSE);
+ cmp->set_cmp_func(thd, this, item->type_handler_for_comparison(),
+ (Item**)&arg_cache, (Item**)&value, FALSE);
DBUG_VOID_RETURN;
}
@@ -4287,8 +4292,14 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
char *buf;
String *new_separator;
- if (!(buf= (char*) thd->stmt_arena->alloc(buflen)) ||
- !(new_separator= new(thd->stmt_arena->mem_root)
+ DBUG_ASSERT(thd->active_stmt_arena_to_use()->
+ is_stmt_prepare_or_first_stmt_execute() ||
+ thd->active_stmt_arena_to_use()->
+ is_conventional() ||
+ thd->active_stmt_arena_to_use()->state ==
+ Query_arena::STMT_SP_QUERY_ARGUMENTS);
+ if (!(buf= (char*) thd->active_stmt_arena_to_use()->alloc(buflen)) ||
+ !(new_separator= new(thd->active_stmt_arena_to_use()->mem_root)
String(buf, buflen, collation.collation)))
return TRUE;