Commit b0ee31c8 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-3942 FROM_DAYS(<timestamp column>) returns different result in MariaDB...

MDEV-3942 FROM_DAYS(<timestamp column>) returns different result in MariaDB comparing to MySQL: NULL vs 0000-00-00

fixed a regression, introduced while fixing MDEV-456
parent 6f26aac9
......@@ -4,5 +4,5 @@ insert t1 values (addtime('9999-12-31 23:59:59', '00:00:01')),
select * from t1;
d
NULL
NULL
0000-00-00 00:00:00
drop table t1;
......@@ -1453,7 +1453,7 @@ MAKEDATE(11111111,1)
NULL
SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
NULL
0
#
# Bug#12584302 AFTER FIX FOR #12403504: ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0,
#
......
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -1386,13 +1387,10 @@ bool Item_func_from_days::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
if (get_date_from_daynr((long) value, &ltime->year, &ltime->month,
&ltime->day))
return (null_value= 1);
if ((fuzzy_date & TIME_NO_ZERO_DATE) && ltime->year == 0)
return (null_value= 1);
return 0;
ltime->time_type= MYSQL_TIMESTAMP_DATE;
return (null_value= 0);
return 0;
}
......
/*
Copyright (c) 2000-2007 MySQL AB, 2009 Sun Microsystems, Inc.
Copyright (c) 2009-2011 Monty Program Ab
Copyright (c) 2009-2013 Monty Program Ab
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
......@@ -153,7 +153,7 @@ bool get_date_from_daynr(long daynr,uint *ret_year,uint *ret_month,
uchar *month_pos;
DBUG_ENTER("get_date_from_daynr");
if (daynr < 365 || daynr > MAX_DAY_NUMBER)
if (daynr < 366 || daynr > MAX_DAY_NUMBER)
DBUG_RETURN(1);
year= (uint) (daynr*100 / 36525L);
......
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