mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
implement Item_func_min_max::get_date()
This commit is contained in:
@ -1527,3 +1527,9 @@ NULL
|
|||||||
Warnings:
|
Warnings:
|
||||||
Warning 1292 Incorrect datetime value: '0000-00-00'
|
Warning 1292 Incorrect datetime value: '0000-00-00'
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
|
||||||
|
insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
|
||||||
|
select least(greatest(f3, f2, f4), f5) from t1;
|
||||||
|
least(greatest(f3, f2, f4), f5)
|
||||||
|
0000-00-00 00:00:00
|
||||||
|
drop table t1;
|
||||||
|
@ -960,3 +960,11 @@ select timestampadd(week, 1, f1) from t1;
|
|||||||
select timestampadd(week, 1, date("0000-00-00"));
|
select timestampadd(week, 1, date("0000-00-00"));
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# lp:737450 Second Assertion `item->null_value' failed in 5.1-micro
|
||||||
|
#
|
||||||
|
create table t1 (f2 time not null, f3 datetime, f4 int not null, f5 timestamp);
|
||||||
|
insert ignore t1 values ('04:38:11','0000-00-00 00:00:00',0,'0000-00-00 00:00:00');
|
||||||
|
select least(greatest(f3, f2, f4), f5) from t1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
@ -2259,9 +2259,6 @@ void Item_func_min_max::fix_length_and_dec()
|
|||||||
/*
|
/*
|
||||||
Compare item arguments in the DATETIME context.
|
Compare item arguments in the DATETIME context.
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
cmp_datetimes()
|
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Compare item arguments as DATETIME values and return the index of the
|
Compare item arguments as DATETIME values and return the index of the
|
||||||
least/greatest argument in the arguments array.
|
least/greatest argument in the arguments array.
|
||||||
@ -2273,9 +2270,10 @@ void Item_func_min_max::fix_length_and_dec()
|
|||||||
0 Otherwise
|
0 Otherwise
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool Item_func_min_max::cmp_datetimes(MYSQL_TIME *ltime)
|
bool Item_func_min_max::get_date(MYSQL_TIME *ltime, uint fuzzy_date)
|
||||||
{
|
{
|
||||||
longlong UNINIT_VAR(min_max);
|
longlong UNINIT_VAR(min_max);
|
||||||
|
DBUG_ASSERT(fixed == 1);
|
||||||
|
|
||||||
for (uint i=0; i < arg_count ; i++)
|
for (uint i=0; i < arg_count ; i++)
|
||||||
{
|
{
|
||||||
@ -2309,7 +2307,7 @@ String *Item_func_min_max::val_str(String *str)
|
|||||||
if (compare_as_dates)
|
if (compare_as_dates)
|
||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (cmp_datetimes(<ime))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char buf[MAX_DATE_STRING_REP_LENGTH];
|
char buf[MAX_DATE_STRING_REP_LENGTH];
|
||||||
@ -2383,7 +2381,7 @@ double Item_func_min_max::val_real()
|
|||||||
if (compare_as_dates)
|
if (compare_as_dates)
|
||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (cmp_datetimes(<ime))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return TIME_to_double(<ime);
|
return TIME_to_double(<ime);
|
||||||
@ -2412,7 +2410,7 @@ longlong Item_func_min_max::val_int()
|
|||||||
if (compare_as_dates)
|
if (compare_as_dates)
|
||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (cmp_datetimes(<ime))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return TIME_to_ulonglong(<ime);
|
return TIME_to_ulonglong(<ime);
|
||||||
@ -2442,7 +2440,7 @@ my_decimal *Item_func_min_max::val_decimal(my_decimal *dec)
|
|||||||
if (compare_as_dates)
|
if (compare_as_dates)
|
||||||
{
|
{
|
||||||
MYSQL_TIME ltime;
|
MYSQL_TIME ltime;
|
||||||
if (cmp_datetimes(<ime))
|
if (get_date(<ime, TIME_FUZZY_DATE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return date2my_decimal(<ime, dec);
|
return date2my_decimal(<ime, dec);
|
||||||
|
@ -769,9 +769,9 @@ public:
|
|||||||
longlong val_int();
|
longlong val_int();
|
||||||
String *val_str(String *);
|
String *val_str(String *);
|
||||||
my_decimal *val_decimal(my_decimal *);
|
my_decimal *val_decimal(my_decimal *);
|
||||||
|
bool get_date(MYSQL_TIME *res, uint fuzzy_date);
|
||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
enum Item_result result_type () const { return cmp_type; }
|
enum Item_result result_type () const { return cmp_type; }
|
||||||
bool cmp_datetimes(MYSQL_TIME *ltime);
|
|
||||||
enum_field_types field_type() const { return cached_field_type; }
|
enum_field_types field_type() const { return cached_field_type; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user