diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-05-03 10:59:54 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-05-03 10:59:54 +0200 |
commit | 9614fde1aac6ffa4745804342ff70a96b2418e30 (patch) | |
tree | d53f4578ce0a6b5cf30f3eef854d50c16fbabcee /sql/field.cc | |
parent | 182b8a29e7a1a0f0fbffeed39518c2c9dc026e13 (diff) | |
parent | 70555454b4c224e85383d482411961c7f2eba2e2 (diff) | |
download | mariadb-git-9614fde1aac6ffa4745804342ff70a96b2418e30.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sql/field.cc b/sql/field.cc index be9c10a3bae..57cf3deed35 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -3116,6 +3116,15 @@ Field *Field_decimal::make_new_field(MEM_ROOT *root, TABLE *new_table, } +void Field_new_decimal::set_and_validate_prec(uint32 len_arg, + uint8 dec_arg, bool unsigned_arg) +{ + precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg); + set_if_smaller(precision, DECIMAL_MAX_PRECISION); + bin_size= my_decimal_get_binary_size(precision, dec); +} + + /**************************************************************************** ** Field_new_decimal ****************************************************************************/ @@ -3134,12 +3143,10 @@ Field_new_decimal::Field_new_decimal(uchar *ptr_arg, uint8 dec_arg,bool zero_arg, bool unsigned_arg) :Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, - unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg) + unireg_check_arg, field_name_arg, + MY_MIN(dec_arg, DECIMAL_MAX_SCALE), zero_arg, unsigned_arg) { - precision= get_decimal_precision(len_arg, dec_arg, unsigned_arg); - DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) && - (dec <= DECIMAL_MAX_SCALE)); - bin_size= my_decimal_get_binary_size(precision, dec); + set_and_validate_prec(len_arg, dec_arg, unsigned_arg); } |