Bug #42662 maketime() and signedness
Submitted: 6 Feb 2009 19:02 Modified: 7 Mar 2010 12:53
Reporter: Tatiana Azundris Nuernberg Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:5.0+ OS:Any
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any

[6 Feb 2009 19:02] Tatiana Azundris Nuernberg
Description:
We lose sign of TIME under certain circumstances.

How to repeat:
SELECT maketime(-1,0,1)='-01:00:01';
1
SELECT TIME(maketime(-1,0,1))=TIME('-01:00:01');
1  (unexpected)
SELECT maketime(-1,0,1)=TIME('-01:00:01');
0
SELECT maketime(1,0,1)=TIME('01:00:01');
1
SELECT maketime(1,0,1)=TIME('01:00:02');
0  (expected)

Suggested fix:
Give it to Tatiana.
[6 Feb 2009 19:22] MySQL Verification Team
Thank you for the bug report.
[9 Feb 2009 5:29] 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/65566

2739 Tatiana A. Nurnberg	2009-02-09
      Bug#42661: sec_to_time() and signedness
      Bug#42662: maketime() and signedness
      
      Item_time_typecast::val_int() dropped sign from
      MYSQL_TIME gotten using from get_time().
      
      Propagates sign now.
[9 Feb 2009 5:30] Tatiana Azundris Nuernberg
fixed by CS for Bug#42661
[14 Apr 2009 19:07] 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/72050

2724 Tatiana A. Nurnberg	2009-04-14 [merge]
      Bug#42662: maketime() and signedness
      
      merge and additional clarifications
     @ mysql-test/r/func_sapdb.result
        Update test for 42661/42662 to use both TIME(...) and CAST(... AS TIME).
        They go through the same code-path here, but may not in the future, and
        besides, it's clearer this way.
     @ mysql-test/t/func_sapdb.test
        Update test for 42661/42662 to use both TIME(...) and CAST(... AS TIME).
        They go through the same code-path here, but may not in the future, and
        besides, it's clearer this way.
     @ sql/item_timefunc.cc
        - fix SEC_TO_TIME(...) for signed values
        - fix TIME(...) and CAST(... AS TIME) for signed values
[15 Apr 2009 16:33] Tatiana Azundris Nuernberg
patch queued for 6.0.11 in -bugteam
[6 May 2009 14:12] Bugs System
Pushed into 6.0.12-alpha (revid:svoj@sun.com-20090506125450-yokcmvqf2g7jhujq) (version source revid:azundris@mysql.com-20090414213640-3grwghkd2fkijx9m) (merge vers: 6.0.11-alpha) (pib:6)
[12 May 2009 1:37] Paul DuBois
Noted in 6.0.12 changelog.

MAKETIME() could lose the sign of negative arguments.
[4 Nov 2009 8:55] 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/89255

2906 Magne Mahre	2009-11-04 [merge]
      Bug#42661: sec_to_time() and signedness
      Bug#42662: maketime() and signedness
            
      Item_time_typecast::val_int() dropped sign from
      MYSQL_TIME gotten using from get_time().
            
      Propagates sign now.
      
      
      Backported to 5.5.0  (6.0-codebase revid: 1810.3897.1)
[4 Nov 2009 9:20] Magne Mæhre
Backported to 5.6.0  (not 5.5.0)
6.0-codebase revid: 1810.3895.9
[20 Nov 2009 12:54] Bugs System
Pushed into 5.6.0-beta (revid:davi.arnaut@sun.com-20091119234808-xbjpkwaxjt5x5c0b) (version source revid:jon.hauglid@sun.com-20090928163426-2lg1gofzz44xzzxf) (merge vers: 6.0.14-alpha) (pib:13)
[20 Nov 2009 12:57] Bugs System
Pushed into 6.0.14-alpha (revid:kostja@sun.com-20091120124947-yi6h2jbgw0kbciwm) (version source revid:jon.hauglid@sun.com-20090928163426-2lg1gofzz44xzzxf) (merge vers: 6.0.14-alpha) (pib:13)
[20 Nov 2009 23:45] Paul DuBois
Noted in 5.6.0 changelog.
[6 Mar 2010 11:07] Bugs System
Pushed into 5.5.3-m3 (revid:alik@sun.com-20100306103849-hha31z2enhh7jwt3) (version source revid:jon.hauglid@sun.com-20090928163426-2lg1gofzz44xzzxf) (merge vers: 6.0.14-alpha) (pib:16)
[7 Mar 2010 12:53] Paul DuBois
Moved 5.6.0 changelog entry to 5.5.3.