diff options
author | Alexander Barkov <bar@mariadb.com> | 2018-11-23 19:04:42 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2018-11-26 08:10:47 +0400 |
commit | 4447a02cf13a49876001a40ca7db8fdedb731fd5 (patch) | |
tree | 1ccf39024e26a1efa68237e5d44a2296a990441d /sql/event_parse_data.cc | |
parent | 27f3329ff6cb755b600d536347669bef1a7d98b5 (diff) | |
download | mariadb-git-4447a02cf13a49876001a40ca7db8fdedb731fd5.tar.gz |
MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMPbb-10.4-mdev16991
Diffstat (limited to 'sql/event_parse_data.cc')
-rw-r--r-- | sql/event_parse_data.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index bfda8438885..00d625879de 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -216,7 +216,13 @@ Event_parse_data::init_execute_at(THD *thd) (starts_null && ends_null))); DBUG_ASSERT(starts_null && ends_null); - if (item_execute_at->get_date(thd, <ime, TIME_NO_ZERO_DATE)) + /* + The expected data type is DATETIME. No nanoseconds truncation should + normally be needed. Using the default rounding mode. + See more comments in event_data_object.cc. + */ + if (item_execute_at->get_date(thd, <ime, TIME_NO_ZERO_DATE | + thd->temporal_round_mode())) goto wrong_value; ltime_utc= TIME_to_timestamp(thd,<ime,¬_used); @@ -378,7 +384,8 @@ Event_parse_data::init_starts(THD *thd) if (item_starts->fix_fields(thd, &item_starts)) goto wrong_value; - if (item_starts->get_date(thd, <ime, TIME_NO_ZERO_DATE)) + if (item_starts->get_date(thd, <ime, TIME_NO_ZERO_DATE | + thd->temporal_round_mode())) goto wrong_value; ltime_utc= TIME_to_timestamp(thd, <ime, ¬_used); @@ -433,7 +440,8 @@ Event_parse_data::init_ends(THD *thd) goto error_bad_params; DBUG_PRINT("info", ("convert to TIME")); - if (item_ends->get_date(thd, <ime, TIME_NO_ZERO_DATE)) + if (item_ends->get_date(thd, <ime, TIME_NO_ZERO_DATE | + thd->temporal_round_mode())) goto error_bad_params; ltime_utc= TIME_to_timestamp(thd, <ime, ¬_used); |