summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-02-08 11:56:18 +0400
committerramil/ram@mysql.com/ramil.myoffice.izhnet.ru <>2007-02-08 11:56:18 +0400
commitfab56c1f243aa02b04e8d3d87104cc4a54db90a2 (patch)
tree6300cc8b4cce39b06e735126668d78b5934cb6e2 /sql-common
parent256cb08ba9c06a619ad52610ccbec28815e8766f (diff)
downloadmariadb-git-fab56c1f243aa02b04e8d3d87104cc4a54db90a2.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.
Diffstat (limited to 'sql-common')
-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 */