Bug #25359 Test 'view' is dependent on current year to be 2006
Submitted: 2 Jan 2007 9:46 Modified: 29 Oct 2007 15:45
Reporter: Kent Boortz Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Tests Severity:S3 (Non-critical)
Version:5.0.30 OS:Any
Assigned to: Sergei Glukhov CPU Architecture:Any

[2 Jan 2007 9:46] Kent Boortz
Description:
The test 'view' contains lines like

 SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75

This breaks when entering 2007

*** r/view.result	2007-01-01 07:36:27.000000000 +0300
--- r/view.reject	2007-01-01 08:19:41.000000000 +0300
***************
*** 2686,2697 ****
  v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
  SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
  Age
! 42
! 38
  SELECT * FROM v1;
  Age
! 42
! 38
  DROP VIEW v1;
  DROP TABLE t1;
  CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
--- 2686,2697 ----
  v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select (year(now()) - year(`t1`.`DOB`)) AS `Age` from `t1` having (`Age` < 75)
  SELECT (year(now())-year(DOB)) AS Age FROM t1 HAVING Age < 75;
  Age
! 43
! 39
  SELECT * FROM v1;
  Age
! 43
! 39
  DROP VIEW v1;
  DROP TABLE t1;
  CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a char(6) DEFAULT 'xxx');
-------------------------------------------------------

How to repeat:
Run the 'view' test case now

Suggested fix:
Adjust test case not to be year dependent
[2 Jan 2007 10:02] 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/17508

ChangeSet@1.2357, 2007-01-02 11:01:48+01:00, kent@mysql.com +1 -0
  view.result:
    Temporary work around for bug#25359
[2 Jan 2007 10:47] Kent Boortz
I updated the year in the result file, but will
then break when entered 2008. So the bug report
is still valid.
[1 Mar 2007 11:36] Sveta Smirnova
Bug #26745 was marked as duplicate of this one
[12 Mar 2007 9:11] Valeriy Kravchuk
Bug #25585 is a duiplicate of this one.
[9 Oct 2007 9:06] 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/35179

ChangeSet@1.2536, 2007-10-09 14:01:41+05:00, gluh@mysql.com +2 -0
  Bug#25359 Test 'view' is dependent on current year to be 2006
  removed now() call to make the test to be year independent
[9 Oct 2007 11:19] Alexander Barkov
The patch http://lists.mysql.com/commits/35179 is ok to push
[9 Oct 2007 11:36] Sergey Vojtovich
Ok to push.
[10 Oct 2007 7: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/35254

ChangeSet@1.2556, 2007-10-10 12:16:13+05:00, gluh@mysql.com +2 -0
  Bug#25359 Test 'view' is dependent on current year to be 2006
  removed now() call to make the test to be year independent
[29 Oct 2007 8:43] Bugs System
Pushed into 5.0.52
[29 Oct 2007 8:47] Bugs System
Pushed into 5.1.23-beta
[29 Oct 2007 8:51] Bugs System
Pushed into 6.0.4-alpha
[29 Oct 2007 15:45] Paul DuBois
Test case change. No changelog entry needed.
[2 Jan 2008 13:13] Valeriy Kravchuk
Bug #33623 was marked as a duplicate of this one.
[29 Jan 2008 20:16] Sveta Smirnova
Bug #34142 was marked as duplicate of this one.
[30 Jan 2008 3:37] imacat .
Dear all,

    Hi.  This is imacat from Taiwan.  I found that this bug still exists in the newly-released MySQL 5.0.51a.  But isn't this bug tagged as "fixed"?  Or will it happen in the beginning of every year?  Will there be a real fix for this?
[30 Jan 2008 7:21] Valeriy Kravchuk
Imacat,

Acording to this comment:

"Pushed into 5.0.52"

fix was included into sources of 5.0.52 and newer versions. 5.0.51a is just 5.0.51 with only one security-related bug fixed. So, it is based on 5.0.51 code and may NOT include this fix.
[30 Jan 2008 17:05] imacat .
> fix was included into sources of 5.0.52 and newer versions. 5.0.51a is just 5.0.51 with only one security-related bug fixed. So, it is based on 5.0.51 code and may NOT include this fix.

OK.  I see.  And the patch #35254 does work.  Thank you for your reply and your patience.
[18 Mar 2008 9:58] Valeriy Kravchuk
Bug #35379 was marked as a duplicate of this one.