Commit 2c80662d authored by Sergei Golubchik's avatar Sergei Golubchik

lp:731103 Assertion `maybe_null && item->null_value' failed with ORDER BY LAST_DAY()

Item_func_last_day did not set mayby_null=1
parent b27b5793
......@@ -5204,8 +5204,8 @@ sub valgrind_arguments {
else
{
mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option
mtr_add_arg($args, "--alignment=8");
mtr_add_arg($args, "--leak-check=yes");
#mtr_add_arg($args, "--db-attach=yes");
mtr_add_arg($args, "--num-callers=16");
mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir)
if -f "$glob_mysql_test_dir/valgrind.supp";
......
......@@ -812,7 +812,7 @@ create table t1 select last_day('2000-02-05') as a,
from_days(to_days("960101")) as b;
describe t1;
Field Type Null Key Default Extra
a date NO 0000-00-00
a date YES NULL
b date YES NULL
select * from t1;
a b
......@@ -1442,3 +1442,29 @@ drop table t1;
select maketime(20,61,10)+0;
maketime(20,61,10)+0
NULL
create table t1 (f2 int not null) ;
insert into t1 values (0),(0);
select last_day(f2) from t1;
last_day(f2)
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
select last_day(f2) from t1 where last_day(f2) is null;
last_day(f2)
NULL
NULL
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
select * from t1 order by last_day (f2);
f2
0
0
Warnings:
Warning 1292 Incorrect datetime value: '0'
Warning 1292 Incorrect datetime value: '0'
drop table t1;
......@@ -901,3 +901,12 @@ drop table t1;
#
select maketime(20,61,10)+0;
#
# lp:731103 Assertion `maybe_null && item->null_value' failed with ORDER BY LAST_DAY()
#
create table t1 (f2 int not null) ;
insert into t1 values (0),(0);
select last_day(f2) from t1;
select last_day(f2) from t1 where last_day(f2) is null;
select * from t1 order by last_day (f2);
drop table t1;
......@@ -862,4 +862,9 @@ public:
Item_func_last_day(Item *a) :Item_datefunc(a) {}
const char *func_name() const { return "last_day"; }
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
void fix_length_and_dec()
{
maybe_null=1;
Item_datefunc::fix_length_and_dec();
}
};
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