maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #09374
Re: Please review MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool)
Hi, Alexander!
On Mar 16, Alexander Barkov wrote:
> Hello Sergei,
>
> Please review a patch for:
>
> MDEV-9653 Assertion `length || !scale' failed in uint
> my_decimal_length_to_precision(uint, uint, bool)
>
> Thanks!
> diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
> index 2783a05..73a47ac 100644
> --- a/sql/item_cmpfunc.cc
> +++ b/sql/item_cmpfunc.cc
> @@ -3086,10 +3086,28 @@ void Item_func_case::agg_str_lengths(Item* arg)
>
> void Item_func_case::agg_num_lengths(Item *arg)
> {
> - uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals,
> - arg->unsigned_flag) - arg->decimals;
> - set_if_bigger(max_length, len);
> - set_if_bigger(decimals, arg->decimals);
> + /*
> + In a query like this:
> + SELECT CASE WHEN TRUE
> + THEN COALESCE(CAST(NULL AS UNSIGNED))
> + ELSE 40
> + END;
> + "arg" corresponding to Item_func_coalesce has:
> + arg->max_length==0
> + arg->decimals==31 (NOT_FIXED_DEC).
why is it NOT_FIXED_DEC? it seems to me that it has to be 0 here.
Regards,
Sergei
Chief Architect MariaDB
and security@xxxxxxxxxxx
Follow ups
References