[MDEV-5882] Bad result for COALESCE(huge_unsigned_number, 1) Created: 2014-03-17  Updated: 2022-09-08

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.36, 10.0.9
Fix Version/s: 5.5

Type: Bug Priority: Minor
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: None


 Description   

Run this SQL script:

SELECT COALESCE(9223372036854775808, 1);
SHOW WARNINGS;

The results are:

+----------------------------------+
| COALESCE(9223372036854775808, 1) |
+----------------------------------+
|              9223372036854775807 |
+----------------------------------+
1 row in set, 1 warning (0.00 sec)
 
+---------+------+-----------------------------------------------------------------------------+
| Level   | Code | Message                                                                     |
+---------+------+-----------------------------------------------------------------------------+
| Warning | 1916 | Got overflow when converting '9223372036854775808' to INT. Value truncated. |
+---------+------+-----------------------------------------------------------------------------+
1 row in set (0.00 set

This is wrong. The expected result is 9223372036854775808 with no warnings.


Generated at Thu Feb 08 07:07:45 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.