Bug #25994 Problem with TIMESTAMPDIFF
Submitted: 31 Jan 2007 22:35 Modified: 1 Feb 2007 9:43
Reporter: a aste Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: General Severity:S2 (Serious)
Version:5.0.27-community-nt OS:Windows (XP)
Assigned to: CPU Architecture:Any
Tags: hour_minute, TIMESTAMPDIFF

[31 Jan 2007 22:35] a aste
Description:
TIMESTAMPDIFF returns an error when using HOUR_MINUTE interval.  

How to repeat:
This works: SELECT TIMESTAMPDIFF(HOUR,datecol_a,datecol_b) FROM sometable;

This works: SELECT TIMESTAMPDIFF(MINUTE,datecol_a,datecol_b) FROM sometable;

This produces an error: SELECT TIMESTAMPDIFF(HOUR_MINUTE,datecol_a,datecol_b) FROM sometable;

HOUR_MINUTE is a valid Interval, according to MySQL documentation.  

The exact error message is: 

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
<pk_barbie> corresponds to your MySQL server version for the right syntax to use near 'HOUR_MINUTE,datecol_a,datecol_b) FROM sometable' at line 1

Suggested fix:
Allow HOUR_MINUTE interval with TIMESTAMPDIFF.
[1 Feb 2007 9:43] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Please read carefully about legal values of the unit argument at http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html