diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-06 22:45:19 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2018-09-06 22:45:19 +0200 |
commit | 31081593aabb116b6d8f86b6c7e76126edb392b4 (patch) | |
tree | 767a069f255359b5ea37e7c491dfeacf6e519fad /sql/field.cc | |
parent | b0026e33af8fc3b25a42099c096a84591fd550e2 (diff) | |
parent | 3a4242fd57b3a2235d2478ed080941b67a82ad1b (diff) | |
download | mariadb-git-31081593aabb116b6d8f86b6c7e76126edb392b4.tar.gz |
Merge branch '11.0' into 10.1
Diffstat (limited to 'sql/field.cc')
-rw-r--r-- | sql/field.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sql/field.cc b/sql/field.cc index 71fc5684d92..ecb383a9575 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -9782,13 +9782,18 @@ void Create_field::create_length_to_internal_length(void) } break; case MYSQL_TYPE_NEWDECIMAL: - key_length= pack_length= - my_decimal_get_binary_size(my_decimal_length_to_precision(length, - decimals, - flags & - UNSIGNED_FLAG), - decimals); + { + /* + This code must be identical to code in + Field_new_decimal::Field_new_decimal as otherwise the record layout + gets out of sync. + */ + uint precision= my_decimal_length_to_precision(length, decimals, + flags & UNSIGNED_FLAG); + set_if_smaller(precision, DECIMAL_MAX_PRECISION); + key_length= pack_length= my_decimal_get_binary_size(precision, decimals); break; + } default: key_length= pack_length= calc_pack_length(sql_type, length); break; |