diff options
author | Alexander Barkov <bar@mariadb.org> | 2013-07-08 16:49:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2013-07-08 16:49:42 +0400 |
commit | 1f3ec9800c6c186949302ba27f0137dfe7c0f5f5 (patch) | |
tree | e0e46189e0c73712d39954f0280c63830fd5332e /sql | |
parent | 874bb251372d60243d44e2ba74f0237bc88ec8c2 (diff) | |
parent | 78cc6db44a9f1344dd5c00cf4f3cdde158fe108e (diff) | |
download | mariadb-git-1f3ec9800c6c186949302ba27f0137dfe7c0f5f5.tar.gz |
Merging from 5.3
modified:
include/my_time.h
libmysql/libmysql.c
mysql-test/r/adddate_454.result
mysql-test/r/cast.result
mysql-test/r/date_formats.result
mysql-test/r/func_sapdb.result
mysql-test/r/func_time.result
mysql-test/r/mdev316.result
mysql-test/r/parser.result
mysql-test/r/partition_datatype.result
mysql-test/r/partition_pruning.result
mysql-test/r/type_date.result
mysql-test/r/type_datetime.result
mysql-test/suite/vcol/r/vcol_misc.result
mysql-test/t/cast.test
sql-common/my_time.c
sql/field.cc
sql/field_conv.cc
sql/filesort.cc
sql/item.cc
sql/item.h
sql/item_cmpfunc.cc
sql/item_func.cc
sql/item_strfunc.cc
sql/item_timefunc.cc
sql/sql_time.cc
pending merges:
Sergei Golubchik 2013-07-03 MDEV-4667 DATE('string') incompability betwe...
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 44 | ||||
-rw-r--r-- | sql/field_conv.cc | 4 | ||||
-rw-r--r-- | sql/filesort.cc | 2 | ||||
-rw-r--r-- | sql/item.cc | 21 | ||||
-rw-r--r-- | sql/item.h | 2 | ||||
-rw-r--r-- | sql/item_cmpfunc.cc | 4 | ||||
-rw-r--r-- | sql/item_func.cc | 6 | ||||
-rw-r--r-- | sql/item_strfunc.cc | 4 | ||||
-rw-r--r-- | sql/item_timefunc.cc | 39 | ||||
-rw-r--r-- | sql/sql_time.cc | 5 |
10 files changed, 66 insertions, 65 deletions
diff --git a/sql/field.cc b/sql/field.cc index 7da46d6b383..0aeb311d65a 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5012,10 +5012,9 @@ int Field_temporal::store(const char *from,uint len,CHARSET_INFO *cs) ErrConvString str(from, len, cs); func_res= str_to_datetime(cs, from, len, <ime, - (TIME_FUZZY_DATE | (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES))), + MODE_INVALID_DATES)), &error); return store_TIME_with_warning(<ime, &str, error, func_res > MYSQL_TIMESTAMP_ERROR); } @@ -5029,11 +5028,10 @@ int Field_temporal::store(double nr) ErrConvDouble str(nr); longlong tmp= double_to_datetime(nr, <ime, - (TIME_FUZZY_DATE | - (thd->variables.sql_mode & + (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES))), &error); + MODE_INVALID_DATES)), &error); return store_TIME_with_warning(<ime, &str, error, tmp != -1); } @@ -5046,11 +5044,10 @@ int Field_temporal::store(longlong nr, bool unsigned_val) THD *thd= table->in_use; ErrConvInteger str(nr); - tmp= number_to_datetime(nr, 0, <ime, (TIME_FUZZY_DATE | - (thd->variables.sql_mode & + tmp= number_to_datetime(nr, 0, <ime, (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES))), &error); + MODE_INVALID_DATES)), &error); return store_TIME_with_warning(<ime, &str, error, tmp != -1); } @@ -5066,17 +5063,16 @@ int Field_temporal::store_time_dec(MYSQL_TIME *ltime, uint dec) structure always fit into DATETIME range. */ have_smth_to_conv= !check_date(&l_time, pack_time(&l_time) != 0, - (TIME_FUZZY_DATE | - (current_thd->variables.sql_mode & + (current_thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES))), &error); + MODE_INVALID_DATES)), &error); return store_TIME_with_warning(&l_time, &str, error, have_smth_to_conv); } my_decimal *Field_temporal::val_decimal(my_decimal *d) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE)) + if (get_date(<ime, 0)) { bzero(<ime, sizeof(ltime)); ltime.time_type= mysql_type_to_time_type(type()); @@ -5215,7 +5211,8 @@ String *Field_time::val_str(String *val_buffer, bool Field_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) { THD *thd= table->in_use; - if (!(fuzzydate & (TIME_FUZZY_DATE|TIME_TIME_ONLY))) + if (!(fuzzydate & TIME_TIME_ONLY) && + (fuzzydate & TIME_NO_ZERO_IN_DATE)) { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_OUT_OF_RANGE, @@ -5345,7 +5342,7 @@ bool Field_time_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) ltime->time_type= MYSQL_TIMESTAMP_TIME; ltime->hour+= (ltime->month*32+ltime->day)*24; ltime->month= ltime->day= 0; - return fuzzydate & (TIME_FUZZY_DATE | TIME_TIME_ONLY) ? 0 : 1; + return !(fuzzydate & TIME_TIME_ONLY) && (fuzzydate & TIME_NO_ZERO_IN_DATE); } @@ -5736,7 +5733,7 @@ void Field_datetime::store_TIME(MYSQL_TIME *ltime) bool Field_datetime::send_binary(Protocol *protocol) { MYSQL_TIME tm; - Field_datetime::get_date(&tm, TIME_FUZZY_DATE); + Field_datetime::get_date(&tm, 0); return protocol->store(&tm, 0); } @@ -5820,7 +5817,7 @@ bool Field_datetime::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) if (!tmp) return fuzzydate & TIME_NO_ZERO_DATE; if (!ltime->month || !ltime->day) - return !(fuzzydate & TIME_FUZZY_DATE); + return fuzzydate & TIME_NO_ZERO_IN_DATE; return 0; } @@ -5873,11 +5870,10 @@ int Field_datetime_hires::store_decimal(const my_decimal *d) error= 2; } else - tmp= number_to_datetime(nr, sec_part, <ime, (TIME_FUZZY_DATE | - (thd->variables.sql_mode & + tmp= number_to_datetime(nr, sec_part, <ime, (thd->variables.sql_mode & (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES))), &error); + MODE_INVALID_DATES)), &error); return store_TIME_with_warning(<ime, &str, error, tmp != -1); } @@ -5885,7 +5881,7 @@ int Field_datetime_hires::store_decimal(const my_decimal *d) bool Field_datetime_hires::send_binary(Protocol *protocol) { MYSQL_TIME ltime; - Field_datetime_hires::get_date(<ime, TIME_FUZZY_DATE); + Field_datetime_hires::get_date(<ime, 0); return protocol->store(<ime, dec); } @@ -5893,14 +5889,14 @@ bool Field_datetime_hires::send_binary(Protocol *protocol) double Field_datetime_hires::val_real(void) { MYSQL_TIME ltime; - Field_datetime_hires::get_date(<ime, TIME_FUZZY_DATE); + Field_datetime_hires::get_date(<ime, 0); return TIME_to_double(<ime); } longlong Field_datetime_hires::val_int(void) { MYSQL_TIME ltime; - Field_datetime_hires::get_date(<ime, TIME_FUZZY_DATE); + Field_datetime_hires::get_date(<ime, 0); return TIME_to_ulonglong_datetime(<ime); } @@ -5909,7 +5905,7 @@ String *Field_datetime_hires::val_str(String *str, String *unused __attribute__((unused))) { MYSQL_TIME ltime; - Field_datetime_hires::get_date(<ime, TIME_FUZZY_DATE); + Field_datetime_hires::get_date(<ime, 0); str->alloc(field_length+1); str->length(field_length); my_datetime_to_str(<ime, (char*) str->ptr(), dec); @@ -5924,7 +5920,7 @@ bool Field_datetime_hires::get_date(MYSQL_TIME *ltime, ulonglong fuzzydate) if (!packed) return fuzzydate & TIME_NO_ZERO_DATE; if (!ltime->month || !ltime->day) - return !(fuzzydate & TIME_FUZZY_DATE); + return fuzzydate & TIME_NO_ZERO_IN_DATE; return 0; } diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 6685b334d06..6c3fcc0d355 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -419,7 +419,7 @@ static void do_field_decimal(Copy_field *copy) static void do_field_temporal(Copy_field *copy) { MYSQL_TIME ltime; - copy->from_field->get_date(<ime, TIME_FUZZY_DATE); + copy->from_field->get_date(<ime, 0); copy->to_field->store_time_dec(<ime, copy->from_field->decimals()); } @@ -890,7 +890,7 @@ int field_conv(Field *to,Field *from) if (from->cmp_type() == TIME_RESULT) { MYSQL_TIME ltime; - if (from->get_date(<ime, TIME_FUZZY_DATE)) + if (from->get_date(<ime, 0)) return to->reset(); else return to->store_time_dec(<ime, from->decimals()); diff --git a/sql/filesort.cc b/sql/filesort.cc index 21b2f213a99..be350037adc 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -874,7 +874,7 @@ static void make_sortkey(register SORTPARAM *param, else { MYSQL_TIME buf; - if (item->get_date_result(&buf, TIME_FUZZY_DATE | TIME_INVALID_DATES)) + if (item->get_date_result(&buf, TIME_INVALID_DATES)) { DBUG_ASSERT(maybe_null); DBUG_ASSERT(item->null_value); diff --git a/sql/item.cc b/sql/item.cc index c251e3d6df3..dc0c977acdd 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -297,7 +297,7 @@ String *Item::val_string_from_decimal(String *str) String *Item::val_string_from_date(String *str) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE) || + if (get_date(<ime, 0) || str->alloc(MAX_DATE_STRING_REP_LENGTH)) { null_value= 1; @@ -354,7 +354,7 @@ my_decimal *Item::val_decimal_from_date(my_decimal *decimal_value) { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE)) + if (get_date(<ime, 0)) { my_decimal_set_zero(decimal_value); null_value= 1; // set NULL, stop processing @@ -413,10 +413,9 @@ int Item::save_time_in_field(Field *field) int Item::save_date_in_field(Field *field) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE | - (current_thd->variables.sql_mode & - (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | - MODE_INVALID_DATES)))) + if (get_date(<ime, (current_thd->variables.sql_mode & + (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | + MODE_INVALID_DATES)))) return set_field_to_null_with_conversions(field, 0); field->set_notnull(); return field->store_time_dec(<ime, decimals); @@ -1280,7 +1279,7 @@ err: if allowed, otherwise - null. */ bzero((char*) ltime,sizeof(*ltime)); - return null_value|= (fuzzydate & (TIME_NO_ZERO_DATE|TIME_NO_ZERO_IN_DATE)); + return null_value|= !(fuzzydate & TIME_FUZZY_DATES); } bool Item::get_seconds(ulonglong *sec, ulong *sec_part) @@ -6385,7 +6384,7 @@ bool Item::send(Protocol *protocol, String *buffer) case MYSQL_TYPE_TIMESTAMP: { MYSQL_TIME tm; - get_date(&tm, TIME_FUZZY_DATE | sql_mode_for_dates()); + get_date(&tm, sql_mode_for_dates()); if (!null_value) { if (f_type == MYSQL_TYPE_DATE) @@ -8610,8 +8609,8 @@ int stored_field_cmp_to_item(THD *thd, Field *field, Item *item) } else { - field->get_date(&field_time, TIME_FUZZY_DATE | TIME_INVALID_DATES); - item->get_date(&item_time, TIME_FUZZY_DATE | TIME_INVALID_DATES); + field->get_date(&field_time, TIME_INVALID_DATES); + item->get_date(&item_time, TIME_INVALID_DATES); } return my_time_compare(&field_time, &item_time); } @@ -8793,7 +8792,7 @@ bool Item_cache_temporal::cache_value() value_cached= true; MYSQL_TIME ltime; - if (example->get_date_result(<ime, TIME_FUZZY_DATE)) + if (example->get_date_result(<ime, 0)) value=0; else value= pack_time(<ime); diff --git a/sql/item.h b/sql/item.h index 2b0456bd30c..b04e879ed4f 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1047,7 +1047,7 @@ public: Item **ref, bool skip_registered); virtual bool get_date(MYSQL_TIME *ltime, ulonglong fuzzydate); bool get_time(MYSQL_TIME *ltime) - { return get_date(ltime, TIME_TIME_ONLY | TIME_FUZZY_DATE); } + { return get_date(ltime, TIME_TIME_ONLY); } bool get_seconds(ulonglong *sec, ulong *sec_part); virtual bool get_date_result(MYSQL_TIME *ltime, ulonglong fuzzydate) { return get_date(ltime,fuzzydate); } diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index dfd60316039..5b0a2520fbc 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -723,7 +723,7 @@ bool get_mysql_time_from_str(THD *thd, String *str, timestamp_type warn_type, bool value; int error; enum_mysql_timestamp_type timestamp_type; - int flags= TIME_FUZZY_DATE | MODE_INVALID_DATES; + int flags= TIME_FUZZY_DATES | MODE_INVALID_DATES; ErrConvString err(str); if (warn_type == MYSQL_TIMESTAMP_TIME) @@ -896,7 +896,7 @@ get_datetime_value(THD *thd, Item ***item_arg, Item **cache_arg, else { MYSQL_TIME ltime; - uint fuzzydate= TIME_FUZZY_DATE | TIME_INVALID_DATES; + uint fuzzydate= TIME_FUZZY_DATES | TIME_INVALID_DATES; if (f_type == MYSQL_TYPE_TIME) fuzzydate|= TIME_TIME_ONLY; if (item->get_date(<ime, fuzzydate)) diff --git a/sql/item_func.cc b/sql/item_func.cc index a5a1eb2987a..b047258818b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2849,7 +2849,7 @@ double Item_func_min_max::val_real() if (compare_as_dates) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE)) + if (get_date(<ime, 0)) return 0; return TIME_to_double(<ime); @@ -2878,7 +2878,7 @@ longlong Item_func_min_max::val_int() if (compare_as_dates) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE)) + if (get_date(<ime, 0)) return 0; return TIME_to_ulonglong(<ime); @@ -2908,7 +2908,7 @@ my_decimal *Item_func_min_max::val_decimal(my_decimal *dec) if (compare_as_dates) { MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE)) + if (get_date(<ime, 0)) return 0; return date2my_decimal(<ime, dec); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index a18ded2de80..c6ca7eb2c3c 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -3873,10 +3873,10 @@ void Item_func_dyncol_create::prepare_arguments() } break; case DYN_COL_DATETIME: - args[valpos]->get_date(&vals[i].x.time_value, TIME_FUZZY_DATE); + args[valpos]->get_date(&vals[i].x.time_value, 0); break; case DYN_COL_DATE: - args[valpos]->get_date(&vals[i].x.time_value, TIME_FUZZY_DATE); + args[valpos]->get_date(&vals[i].x.time_value, 0); break; case DYN_COL_TIME: args[valpos]->get_time(&vals[i].x.time_value); diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 82379fd24e1..7bf0e25e848 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -780,7 +780,7 @@ longlong Item_func_to_seconds::val_int_endpoint(bool left_endp, longlong seconds; longlong days; int dummy; /* unused */ - if (get_arg0_date(<ime, TIME_FUZZY_DATE)) + if (get_arg0_date(<ime, TIME_FUZZY_DATES)) { /* got NULL, leave the incl_endp intact */ return LONGLONG_MIN; @@ -858,7 +858,7 @@ longlong Item_func_to_days::val_int_endpoint(bool left_endp, bool *incl_endp) MYSQL_TIME ltime; longlong res; int dummy; /* unused */ - if (get_arg0_date(<ime, TIME_FUZZY_DATE)) + if (get_arg0_date(<ime, 0)) { /* got NULL, leave the incl_endp intact */ return LONGLONG_MIN; @@ -922,14 +922,14 @@ longlong Item_func_dayofmonth::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.day; + return get_arg0_date(<ime, 0) ? 0 : (longlong) ltime.day; } longlong Item_func_month::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.month; + return get_arg0_date(<ime, 0) ? 0 : (longlong) ltime.month; } @@ -953,7 +953,7 @@ String* Item_func_monthname::val_str(String* str) uint err; MYSQL_TIME ltime; - if ((null_value= (get_arg0_date(<ime, TIME_FUZZY_DATE) || !ltime.month))) + if ((null_value= (get_arg0_date(<ime, 0) || !ltime.month))) return (String *) 0; month_name= locale->month_names->type_names[ltime.month - 1]; @@ -971,7 +971,7 @@ longlong Item_func_quarter::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_FUZZY_DATE)) + if (get_arg0_date(<ime, 0)) return 0; return (longlong) ((ltime.month+2)/3); } @@ -1045,7 +1045,7 @@ longlong Item_func_week::val_int() DBUG_ASSERT(fixed == 1); uint year; MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; return (longlong) calc_week(<ime, week_mode((uint) args[1]->val_int()), @@ -1058,7 +1058,7 @@ longlong Item_func_yearweek::val_int() DBUG_ASSERT(fixed == 1); uint year,week; MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; week= calc_week(<ime, (week_mode((uint) args[1]->val_int()) | WEEK_YEAR), @@ -1072,7 +1072,7 @@ longlong Item_func_weekday::val_int() DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_NO_ZERO_DATE)) + if (get_arg0_date(<ime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE)) return 0; return (longlong) calc_weekday(calc_daynr(ltime.year, ltime.month, @@ -1114,7 +1114,7 @@ longlong Item_func_year::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - return get_arg0_date(<ime, TIME_FUZZY_DATE) ? 0 : (longlong) ltime.year; + return get_arg0_date(<ime, 0) ? 0 : (longlong) ltime.year; } @@ -1146,7 +1146,7 @@ longlong Item_func_year::val_int_endpoint(bool left_endp, bool *incl_endp) { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_arg0_date(<ime, TIME_FUZZY_DATE)) + if (get_arg0_date(<ime, 0)) { /* got NULL, leave the incl_endp intact */ return LONGLONG_MIN; @@ -1467,7 +1467,7 @@ longlong Item_temporal_func::val_int() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE | sql_mode)) + if (get_date(<ime, sql_mode)) return 0; longlong v= TIME_to_ulonglong(<ime); return ltime.neg ? -v : v; @@ -1478,7 +1478,7 @@ double Item_temporal_func::val_real() { DBUG_ASSERT(fixed == 1); MYSQL_TIME ltime; - if (get_date(<ime, TIME_FUZZY_DATE | sql_mode)) + if (get_date(<ime, sql_mode)) return 0; return TIME_to_double(<ime); } @@ -1858,7 +1858,7 @@ String *Item_func_date_format::val_str(String *str) int is_time_flag = is_time_format ? TIME_TIME_ONLY : 0; DBUG_ASSERT(fixed == 1); - if (get_arg0_date(&l_time, TIME_FUZZY_DATE | is_time_flag)) + if (get_arg0_date(&l_time, is_time_flag)) return 0; if (!(format = args[1]->val_str(str)) || !format->length()) @@ -2032,10 +2032,15 @@ bool Item_date_add_interval::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { INTERVAL interval; - if (args[0]->get_date(ltime, TIME_NO_ZERO_DATE | TIME_FUZZY_DATE | TIME_NO_ZERO_IN_DATE) || + if (args[0]->get_date(ltime, 0) || get_interval_value(args[1], int_type, &interval)) return (null_value=1); + if (ltime->time_type != MYSQL_TIMESTAMP_TIME && + check_date_with_warn(ltime, TIME_NO_ZERO_DATE | TIME_NO_ZERO_IN_DATE, + MYSQL_TIMESTAMP_ERROR)) + return (null_value=1); + if (date_sub_interval) interval.neg = !interval.neg; @@ -2128,7 +2133,7 @@ longlong Item_extract::val_int() long neg; int is_time_flag = date_value ? 0 : TIME_TIME_ONLY; - if (get_arg0_date(<ime, TIME_FUZZY_DATE | is_time_flag)) + if (get_arg0_date(<ime, is_time_flag)) return 0; neg= ltime.neg ? -1 : 1; @@ -2553,7 +2558,7 @@ bool Item_func_add_time::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) if (is_date) // TIMESTAMP function { - if (get_arg0_date(&l_time1, TIME_FUZZY_DATE) || + if (get_arg0_date(&l_time1, 0) || args[1]->get_time(&l_time2) || l_time1.time_type == MYSQL_TIMESTAMP_TIME || l_time2.time_type != MYSQL_TIMESTAMP_TIME) diff --git a/sql/sql_time.cc b/sql/sql_time.cc index 82e8898657d..dab8a907678 100644 --- a/sql/sql_time.cc +++ b/sql/sql_time.cc @@ -332,7 +332,7 @@ str_to_datetime_with_warn(CHARSET_INFO *cs, @param nr integer part of the number to convert @param sec_part microsecond part of the number @param ltime converted value will be written here - @param fuzzydate conversion flags (TIME_FUZZY_DATE, etc) + @param fuzzydate conversion flags (TIME_INVALID_DATE, etc) @param str original number, as an ErrConv. For the warning @param field_name field name or NULL if not a field. For the warning @@ -349,6 +349,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, if (fuzzydate & TIME_TIME_ONLY) { + fuzzydate= TIME_TIME_ONLY; // clear other flags f_type= MYSQL_TYPE_TIME; res= number_to_time(neg, nr, sec_part, ltime, &was_cut); } @@ -358,7 +359,7 @@ static bool number_to_time_with_warn(bool neg, ulonglong nr, ulong sec_part, res= neg ? -1 : number_to_datetime(nr, sec_part, ltime, fuzzydate, &was_cut); } - if (res < 0 || (was_cut && !(fuzzydate & TIME_FUZZY_DATE))) + if (res < 0 || (was_cut && (fuzzydate & TIME_NO_ZERO_IN_DATE))) { make_truncated_value_warning(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, str, |