diff options
author | unknown <jimw@mysql.com> | 2005-10-13 15:32:31 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-10-13 15:32:31 -0700 |
commit | e84f7939ecdebf760f345e61da0ea267311f0db6 (patch) | |
tree | 74b1654f734a495d34d748769708786579722b51 /mysql-test/t/func_time.test | |
parent | 979446f356ce0ad3c388a2cca5dd39bad59a9243 (diff) | |
download | mariadb-git-e84f7939ecdebf760f345e61da0ea267311f0db6.tar.gz |
Fix calculation of TIMESTAMPDIFF() of months and years. (Bug #13534)
mysql-test/r/func_time.result:
Add new results
mysql-test/t/func_time.test:
Add new regression test
sql/item_timefunc.cc:
Fix calculation of years and months in TIMESTAMPDIFF().
Diffstat (limited to 'mysql-test/t/func_time.test')
-rw-r--r-- | mysql-test/t/func_time.test | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 3dd7f7276fb..3a2eea59bed 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -404,4 +404,28 @@ delimiter ;// call t_sysdate(); drop procedure t_sysdate; +# +# Bug #13534: timestampdiff() returned incorrect results across leap years +# +select timestampdiff(month,'2004-09-11','2004-09-11'); +select timestampdiff(month,'2004-09-11','2005-09-11'); +select timestampdiff(month,'2004-09-11','2006-09-11'); +select timestampdiff(month,'2004-09-11','2007-09-11'); +select timestampdiff(month,'2005-09-11','2004-09-11'); +select timestampdiff(month,'2005-09-11','2003-09-11'); + +select timestampdiff(month,'2004-02-28','2005-02-28'); +select timestampdiff(month,'2004-02-29','2005-02-28'); +select timestampdiff(month,'2004-02-28','2005-02-28'); +select timestampdiff(month,'2004-03-29','2005-03-28'); +select timestampdiff(month,'2003-02-28','2004-02-29'); +select timestampdiff(month,'2003-02-28','2005-02-28'); + +select timestampdiff(month,'1999-09-11','2001-10-10'); +select timestampdiff(month,'1999-09-11','2001-9-11'); + +select timestampdiff(year,'1999-09-11','2001-9-11'); +select timestampdiff(year,'2004-02-28','2005-02-28'); +select timestampdiff(year,'2004-02-29','2005-02-28'); + # End of 5.0 tests |