From 661daf16f11ffa879ffb005008b6e73f6744e0ad Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 4 Jun 2014 20:32:57 +0400 Subject: MDEV-4858 Wrong results for a huge unsigned value inserted into a TIME column MDEV-6099 Bad results for DATE_ADD(.., INTERVAL 2000000000000000000.0 SECOND) MDEV-6097 Inconsistent results for CAST(int,decimal,double AS DATETIME) MDEV-6100 No warning on CAST(9000000 AS TIME) --- sql/item_timefunc.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sql/item_timefunc.cc') diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index fbc7bc36842..bb93fc08faa 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -1206,6 +1206,18 @@ bool get_interval_value(Item *args,interval_type int_type, if (!(val= args->val_decimal(&decimal_value))) return true; interval->neg= my_decimal2seconds(val, &second, &second_part); + if (second == LONGLONG_MAX) + { + char buff[DECIMAL_MAX_STR_LENGTH]; + int length= sizeof(buff); + decimal2string(val, buff, &length, 0, 0, 0); + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_WARN, + ER_TRUNCATED_WRONG_VALUE, + ER(ER_TRUNCATED_WRONG_VALUE), "DECIMAL", + buff); + return true; + } + interval->second= second; interval->second_part= second_part; return false; -- cgit v1.2.1