mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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).
This commit is contained in:
@ -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); }
|
||||
|
Reference in New Issue
Block a user