Commit 773f9dcc authored by unknown's avatar unknown

Bug#30951: makedate returns different results depending on version of mysql

makedate() will fold years below 100 into the 1970-2069 range. CS removes code
that also wrongly folded years between 100 and 200 into that range, which should
be left unchanged. Backport from 5.1.


mysql-test/r/func_sapdb.result:
  Show that makedate() works correctly for 100 <= year < 200.
mysql-test/t/func_sapdb.test:
  Show that makedate() works correctly for 100 <= year < 200.
sql-common/my_time.c:
  Remove unnecessary date magic. Syncs behaviour with 5.1+
  and manual.
parent 461e4668
......@@ -93,6 +93,9 @@ makedate(9999,365)
select makedate(9999,366);
makedate(9999,366)
NULL
select makedate(100,1);
makedate(100,1)
0100-01-01
select addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002");
addtime("1997-12-31 23:59:59.999999", "1 1:1:1.000002")
1998-01-02 01:01:01.000001
......
......@@ -47,6 +47,7 @@ select makedate(1997,1);
select makedate(1997,0);
select makedate(9999,365);
select makedate(9999,366);
select makedate(100,1);
#Time functions
......
......@@ -769,11 +769,6 @@ long calc_daynr(uint year,uint month,uint day)
if (year == 0 && month == 0 && day == 0)
DBUG_RETURN(0); /* Skip errors */
if (year < 200)
{
if ((year=year+1900) < 1900+YY_PART_YEAR)
year+=100;
}
delsum= (long) (365L * year+ 31*(month-1) +day);
if (month <= 2)
year--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment