1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-33836 Compute modulus correctly in sequence

When the sequence is unsigned bigint, it needs to be cast to unsigned
for correct computation of the modulus.
This commit is contained in:
Yuchen Pei
2024-08-12 10:33:12 +10:00
parent 2603453436
commit 8b8c8fcb86
5 changed files with 58 additions and 1 deletions

View File

@ -751,7 +751,10 @@ void sequence_definition::adjust_values(longlong next_value)
next_free_value % real_increment == offset
*/
off= next_free_value % real_increment;
if (is_unsigned)
off= (ulonglong) next_free_value % real_increment;
else
off= next_free_value % real_increment;
if (off < 0)
off+= real_increment;
to_add= (real_increment + offset - off) % real_increment;