[MDEV-4857] Wrong result of HOUR('1 00:00:00') Created: 2013-08-08  Updated: 2014-01-29  Resolved: 2013-12-10

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.3
Fix Version/s: 10.0.7

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


 Description   

HOUR() correctly returns hour>23 values in this script:

CREATE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('1 00:00:00');
SELECT a, HOUR(a) FROM t1;
+----------+---------+
| a        | HOUR(a) |
+----------+---------+
| 24:00:00 |      24 |
+----------+---------+

and in this script:

SELECT HOUR(MAKETIME(24,0,0));
+------------------------+
| HOUR(MAKETIME(24,0,0)) |
+------------------------+
|                     24 |
+------------------------+

However, it does not work well in some cases:

SELECT HOUR('1 00:00:00'), HOUR(TIME('1 00:00:00'));
+--------------------+--------------------------+
| HOUR('1 00:00:00') | HOUR(TIME('1 00:00:00')) |
+--------------------+--------------------------+
|                  0 |                        0 |
+--------------------+--------------------------+

MySQL-5.5 exhibit the same behaviour.
MySQL-5.6 correctly returns "24" for both expressions in the last query.

So this bug should probably be fixed only in 10.0
(while 5.3 and 5.5 should keep the original behaviour).



 Comments   
Comment by Sergei Golubchik [ 2013-08-09 ]

I'd say, it should be fixed from 5.3 upwards

Comment by Alexander Barkov [ 2013-12-10 ]

Fixed in 5.3 and 5.5.

Comment by Daniel Bartholomew [ 2014-01-29 ]

http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/3992

http://bazaar.launchpad.net/~maria-captains/maria/5.5/revision/2502.567.173

Generated at Thu Feb 08 06:59:43 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.