Commit 684405e7 authored by Sergei Golubchik's avatar Sergei Golubchik

lp:737092 Assertion `item->null_value' failed in get_datetime_value in 5.1-micro

Implement Item_func_coalesce::get_date()
parent 256185c5
......@@ -1494,3 +1494,6 @@ least(1, f1)
Warnings:
Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1
drop table t1;
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
now() > coalesce(time('21:43:24'), date('2010-05-03'))
1
......@@ -932,3 +932,9 @@ create table t1 (f1 timestamp);
insert into t1 values ('0000-00-00 00:00:00');
select least(1, f1) from t1;
drop table t1;
#
# lp:737092 Assertion `item->null_value' failed in get_datetime_value in 5.1-micro
#
select now() > coalesce(time('21:43:24'), date('2010-05-03'));
......@@ -2901,6 +2901,21 @@ double Item_func_coalesce::real_op()
}
bool Item_func_coalesce::get_date(MYSQL_TIME *ltime,uint fuzzydate)
{
DBUG_ASSERT(fixed == 1);
null_value= 0;
for (uint i= 0; i < arg_count; i++)
{
bool res= args[i]->get_date(ltime, fuzzydate);
if (!args[i]->null_value)
return res;
}
null_value=1;
return 0;
}
my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value)
{
DBUG_ASSERT(fixed == 1);
......
......@@ -675,6 +675,7 @@ public:
const char *func_name() const { return "coalesce"; }
table_map not_null_tables() const { return 0; }
enum_field_types field_type() const { return cached_field_type; }
bool get_date(MYSQL_TIME *ltime,uint fuzzydate);
};
......
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