Bug #111324 Return wrong result
Submitted: 8 Jun 2023 3:23 Modified: 8 Jun 2023 14:18
Reporter: Doris Li Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:8.0.33 OS:Ubuntu (20.04.2)
Assigned to: CPU Architecture:x86 (x86_64)

[8 Jun 2023 3:23] Doris Li
Description:
select '180153763202434582' = 180153763202434585;
+-------------------------------------------+
| '180153763202434582' = 180153763202434585 |
+-------------------------------------------+
|                                         1 |
+-------------------------------------------+
1 row in set (0.00 sec)

The query should return 0 but it returns 1, which is incorrect.

How to repeat:
Run the query above.
[8 Jun 2023 14:18] MySQL Verification Team
Hi,

The problem is that the values that you are using are larger then signed 64-big integer. This is a default type for the integer constants in SQL.

But, with a little extra SQL, it works just fine:

select cast('18015376320243458' as UNSIGNED INTEGER) = 180153763202434585;
+------------------------------------------------------------------------------+
| cast('18015376320243458' as UNSIGNED INTEGER) = 180153763202434585 |
+------------------------------------------------------------------------------+
|                                                                                                                              0 |
+-----------------------------------------------------------------------------+

Not a bug.
[20 Jul 2023 3:02] fander chan
Your interpretation is that '180153763202434582' was truncated to '18015376320243458', and '180153763202434585' was also truncated to '18015376320243458', thus making them equal. Is that correct?