Bug #30782 | Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, JOIN, and ORDER BY | ||
---|---|---|---|
Submitted: | 4 Sep 2007 8:34 | Modified: | 9 Jan 2008 14:36 |
Reporter: | Keefe Johnson | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: Data Types | Severity: | S2 (Serious) |
Version: | 5.0.45, 4.1, 5.1, 5.2 BK | OS: | Any (Linux, Windows XP SP2) |
Assigned to: | Ramil Kalimullin | CPU Architecture: | Any |
[4 Sep 2007 8:34]
Keefe Johnson
[4 Sep 2007 11:07]
Sveta Smirnova
Thank you for the report. Verified as described. Can be related with bug #30622
[4 Sep 2007 20:26]
Keefe Johnson
I doubt it is directly related to bug #30622, for the following reasons: * Bug #30622 seems to only occur with BLOB types. This new bug affects UNSIGNED BIGINT. * Bug #30622 caused rows to not be returned at all, but as another example of this new bug shows below, a WHERE clause still works, although with the same truncation of the values. * This new bug only occurs when the SELECT has a CASE and a JOIN in addition to the ORDER BY and optional WHERE. mysql> select t1.a, (case t1.a when 0 then 0 else t1.b end) d from t1 join t2 on t1.a=t2.c where b=11120436154190595086 order by d; +------+---------------------+ | a | d | +------+---------------------+ | 3 | 9999999999999999999 | +------+---------------------+ 1 row in set (0.00 sec)
[22 Oct 2007 12:11]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/36027 ChangeSet@1.2542, 2007-10-22 17:11:40+05:00, ramil@mysql.com +4 -0 Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, JOIN, and ORDER BY Problem: improper maximum length calculation of the CASE function leads to decimal value truncation (storing/retrieving decimal field values). Fix: accurately calculate maximum length/unsigned flag/decimals parameters of the CASE function.
[29 Oct 2007 7:17]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/36521 ChangeSet@1.2542, 2007-10-29 11:17:51+04:00, ramil@mysql.com +4 -0 Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, JOIN, and ORDER BY Problem: improper maximum length calculation of the CASE function leads to decimal value truncation (storing/retrieving decimal field values). Fix: accurately calculate maximum length/unsigned flag/decimals parameters of the CASE function.
[29 Oct 2007 8:20]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/36522 ChangeSet@1.2542, 2007-10-29 12:20:21+04:00, ramil@mysql.com +4 -0 Fix for bug #30782: Truncated UNSIGNED BIGINT columns only in SELECT w/ CASE, JOIN, and ORDER BY Problem: improper maximum length calculation of the CASE function leads to decimal value truncation (storing/retrieving decimal field values). Fix: accurately calculate maximum length/unsigned flag/decimals parameters of the CASE function.
[7 Dec 2007 23:07]
Bugs System
Pushed into 6.0.5-alpha
[7 Dec 2007 23:09]
Bugs System
Pushed into 5.1.23-rc
[7 Dec 2007 23:10]
Bugs System
Pushed into 5.0.54
[9 Jan 2008 14:36]
Paul DuBois
Noted in 5.0.54, 5.1.23, 6.0.5 changelogs. Improper calculation of CASE expression results could lead to value truncation.