MDEV-21195 INSERT chooses wrong partition for RANGE partitioning by DECIMAL column

Use FLOOR rounding for DECIMAL_RESULT item_expr in partition function.
This commit is contained in:
Aleksey Midenkov
2020-02-02 15:13:29 +03:00
parent 74deeaee34
commit b0fa308086
5 changed files with 116 additions and 6 deletions

View File

@ -345,12 +345,12 @@ void my_decimal_trim(ulonglong *precision, uint *scale)
*/
int my_decimal2int(uint mask, const decimal_t *d, bool unsigned_flag,
longlong *l)
longlong *l, decimal_round_mode round_type)
{
int res;
my_decimal rounded;
/* decimal_round can return only E_DEC_TRUNCATED */
decimal_round(d, &rounded, 0, HALF_UP);
decimal_round(d, &rounded, 0, round_type);
res= (unsigned_flag ?
decimal2ulonglong(&rounded, (ulonglong *) l) :
decimal2longlong(&rounded, l));