Commit 34c94288 authored by Sergei Golubchik's avatar Sergei Golubchik

fix for double or decimal to datetime conversion

parent 306ed653
......@@ -87,6 +87,11 @@ Warning 1292 Truncated incorrect time value: '-3020399.9999999'
select 20010101000203.000000004 + interval 1 day;
20010101000203.000000004 + interval 1 day
2001-01-02 00:02:03.000000
Warnings:
Warning 1292 Truncated incorrect datetime value: '20010101000203.000000004'
select 20010101000203.4 + interval 1 day;
20010101000203.4 + interval 1 day
2001-01-02 00:02:03.4
set @a=cast('2011-01-02 12:13:14' as datetime);
select @a + interval 1 minute;
@a + interval 1 minute
......
......@@ -33,6 +33,7 @@ drop table t1;
select sec_to_time(3020399.99999), sec_to_time(3020399.999999), sec_to_time(3020399.9999999);
select sec_to_time(-3020399.99999), sec_to_time(-3020399.999999), sec_to_time(-3020399.9999999);
select 20010101000203.000000004 + interval 1 day;
select 20010101000203.4 + interval 1 day;
#
# precision of expressions
#
......
......@@ -984,7 +984,7 @@ bool Item::get_date(MYSQL_TIME *ltime,uint fuzzydate)
{
if (field_type() == MYSQL_TYPE_TIME)
fuzzydate|= TIME_TIME_ONLY;
if (result_type() == STRING_RESULT || fuzzydate & TIME_TIME_ONLY)
if (result_type() != INT_RESULT || fuzzydate & TIME_TIME_ONLY)
{
char buff[40];
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment