diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-06-15 10:11:51 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-06-15 10:11:51 +0400 |
commit | c55de8d40bba29503773a6a56d6f13f19ca7e339 (patch) | |
tree | 46bd1a7c74a16fa8b268df8bfe28a994ea752973 /sql/field.h | |
parent | ec4fdd574964d3611e904fa5f1751d88d8e8286f (diff) | |
download | mariadb-git-c55de8d40bba29503773a6a56d6f13f19ca7e339.tar.gz |
MDEV-9334 ALTER from DECIMAL to BIGINT UNSIGNED returns a wrong result
When altering from DECIMAL to *INT UNIGNED or to BIT, go through val_decimal(),
to avoid truncation to the biggest possible signed integer
(0x7FFFFFFFFFFFFFFF / 9223372036854775807).
Diffstat (limited to 'sql/field.h')
-rw-r--r-- | sql/field.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/field.h b/sql/field.h index ca85a7c276f..e554f92031c 100644 --- a/sql/field.h +++ b/sql/field.h @@ -1636,6 +1636,8 @@ public: bool eq_def(const Field *field) const; Copy_func *get_copy_func(const Field *from) const { + if (unsigned_flag && from->cmp_type() == DECIMAL_RESULT) + return do_field_decimal; return do_field_int; } int save_in_field(Field *to) @@ -3661,6 +3663,8 @@ public: } Copy_func *get_copy_func(const Field *from) const { + if (from->cmp_type() == DECIMAL_RESULT) + return do_field_decimal; return do_field_int; } int save_in_field(Field *to) { return to->store(val_int(), true); } |