summaryrefslogtreecommitdiff
path: root/sql-common/my_time.c
diff options
context:
space:
mode:
authorunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-02-08 11:56:18 +0400
committerunknown <ramil/ram@mysql.com/ramil.myoffice.izhnet.ru>2007-02-08 11:56:18 +0400
commit34d20085f320334e7d6e561d8f85a90f31fa784a (patch)
tree6300cc8b4cce39b06e735126668d78b5934cb6e2 /sql-common/my_time.c
parent31aee856d83684d4f53e6037d02e1240f694e7cb (diff)
downloadmariadb-git-34d20085f320334e7d6e561d8f85a90f31fa784a.tar.gz
Fix for bug #25301: Non-zero dates with year 0000 are invalid
The 0000 year is valid. The ISO standard for "Representation of dates and times" says: "Calendar years are numbered in ascending order according to the Gregorian calendar by values in the range [0000] to [9999]." Reverted fix for 21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted as it's not a bug. Fix for 19370: DateTime datatype in MySQL has two bugs in it will be reverted during 4.1 -> 5.0 merging as it was pushed to the 5.0 tree. mysql-test/r/date_formats.result: Fix for bug #25301: Non-zero dates with year 0000 are invalid - reverted fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted sql-common/my_time.c: Fix for bug #25301: Non-zero dates with year 0000 are invalid - reverted fix for bug #21789: DATETIME with 0000-00-00 11:22:33 should be invalid, but is accepted
Diffstat (limited to 'sql-common/my_time.c')
-rw-r--r--sql-common/my_time.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 2d3d71e646c..0d8ad167ff5 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -350,10 +350,7 @@ str_to_datetime(const char *str, uint length, MYSQL_TIME *l_time,
l_time->year > 9999 || l_time->month > 12 ||
l_time->day > 31 || l_time->hour > 23 ||
l_time->minute > 59 || l_time->second > 59 ||
- (!(flags & TIME_FUZZY_DATE) &&
- (l_time->month == 0 || l_time->day == 0)) ||
- (l_time->year == 0 && l_time->month == 0 && l_time->day == 0 &&
- (l_time->hour != 0 || l_time->minute != 0 || l_time->second != 0)))
+ (!(flags & TIME_FUZZY_DATE) && (l_time->month == 0 || l_time->day == 0)))
{
/* Only give warning for a zero date if there is some garbage after */
if (!not_zero_date) /* If zero date */