summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-09-09 08:33:08 +0200
committerSergei Golubchik <serg@mariadb.org>2016-09-09 08:33:08 +0200
commit06b7fce9f24116080168b924d17f71b979fc3a14 (patch)
tree5ff9f5684bb118abbee5a9fd3b838d0841661287 /sql/item_sum.cc
parent1f2ff25eba6c089b2698cd0dab96155ccbf2afd2 (diff)
parent8494039757a2f6353cc161e7824aab4fe2312d2a (diff)
downloadmariadb-git-06b7fce9f24116080168b924d17f71b979fc3a14.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index cc7a76213f0..c656d6678fc 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -381,6 +381,16 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref)
sl->master_unit()->item->with_sum_func= 1;
}
thd->lex->current_select->mark_as_dependent(thd, aggr_sel, NULL);
+
+ if ((thd->lex->describe & DESCRIBE_EXTENDED) && aggr_sel)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
+ ER_WARN_AGGFUNC_DEPENDENCE,
+ ER_THD(thd, ER_WARN_AGGFUNC_DEPENDENCE),
+ func_name(),
+ thd->lex->current_select->select_number,
+ aggr_sel->select_number);
+ }
return FALSE;
}
@@ -1422,7 +1432,7 @@ my_decimal *Item_sum_sum::val_decimal(my_decimal *val)
if (aggr)
aggr->endup();
if (Item_sum_sum::result_type() == DECIMAL_RESULT)
- return (dec_buffs + curr_dec_buff);
+ return null_value ? NULL : (dec_buffs + curr_dec_buff);
return val_decimal_from_real(val);
}
@@ -1756,6 +1766,8 @@ double Item_sum_std::val_real()
{
DBUG_ASSERT(fixed == 1);
double nr= Item_sum_variance::val_real();
+ if (my_isinf(nr))
+ return DBL_MAX;
DBUG_ASSERT(nr >= 0.0);
return sqrt(nr);
}