1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

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

Item_func_last_day did not set mayby_null=1
This commit is contained in:
Sergei Golubchik
2011-03-08 10:14:43 +01:00
parent b27b5793a0
commit 2c80662d23
4 changed files with 42 additions and 2 deletions

View File

@@ -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";

View File

@@ -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;

View File

@@ -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;

View File

@@ -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();
}
};