[MDEV-30547] Problems when mod , division function and extremum function are used together Created: 2023-02-02  Updated: 2023-02-02  Resolved: 2023-02-02

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.9.4
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: 王瑞丰 Assignee: Sergei Golubchik
Resolution: Duplicate Votes: 0
Labels: None
Environment:

mariadb docker


Issue Links:
Duplicate
duplicates MDEV-6856 <negative value> MOD <fractional divi... Open

 Description   

We found that problems also occur when we use the mod function, the division function and two extremal functions together

select least('0'/-4,0/-4); – -0
select greatest('0'/-4,0/-4); – 0
select least(mod('-12',-4),mod(-12,-4)); – -0
select Greatest(mod('-12',-4),mod(-12,-4)); – 0

We tested the following two use cases
select mod('-12',-4) = mod(-12,-4); – 1
select '0'/-4 = 0/4; – 1

These two use cases prove that the two calculation results are equal. We hope that the extreme value function can give the same result, because the operation process of these two extreme value functions should also be the ultimate result of the comparison operator.
Although the result of the internal mod function or division function is incorrect, we think that the extreme value function should eliminate the influence of the negative number representation and give the correct answer.

MySQL has verified this as a bug. please see https://bugs.mysql.com/bug.php?id=109842. so I consider it also a bug for mariadb.


Generated at Thu Feb 08 10:17:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.