diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 5d06d9c4dd8..c230897c502 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -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"; diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 654ab0f7351..781d2bf3e97 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -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; diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index a24261cdf90..5d8d4427ab0 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -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; diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index e2e65142902..36be86cd89c 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -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(); + } };