mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
lp:736791 Crash in make_truncated_value_warningwith LEAST()/GREATEST/COALESCE
and a test case for lp:736370 Datetime functions in subquery context cause wrong result
This commit is contained in:
@@ -1476,3 +1476,21 @@ Warning 1292 Truncated incorrect time value: '-596523:14:07'
|
||||
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
|
||||
convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow')
|
||||
NULL
|
||||
create table t1 (f1 integer, f2 date);
|
||||
insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05');
|
||||
select * from t1 where (f1, f2) in (select f1, makedate(2011 , 125) from t1);
|
||||
f1 f2
|
||||
1 2011-05-05
|
||||
2 2011-05-05
|
||||
3 2011-05-05
|
||||
4 2011-05-05
|
||||
5 2011-05-05
|
||||
drop table t1;
|
||||
create table t1 (f1 timestamp);
|
||||
insert into t1 values ('0000-00-00 00:00:00');
|
||||
select least(1, f1) from t1;
|
||||
least(1, f1)
|
||||
0000-00-00 00:00:00
|
||||
Warnings:
|
||||
Warning 1292 Incorrect datetime value: '1' for column 'f1' at row 1
|
||||
drop table t1;
|
||||
|
||||
@@ -916,3 +916,19 @@ drop table t1;
|
||||
#
|
||||
select timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime));
|
||||
select convert_tz(timediff('0000-00-00 00:00:00', cast('2008-03-26 07:09:06' as datetime)), 'UTC', 'Europe/Moscow');
|
||||
|
||||
#
|
||||
# lp:736370 Datetime functions in subquery context cause wrong result and bogus warnings in mysql-5.1-micr
|
||||
#
|
||||
create table t1 (f1 integer, f2 date);
|
||||
insert into t1 values (1,'2011-05-05'),(2,'2011-05-05'),(3,'2011-05-05'),(4,'2011-05-05'),(5,'2011-05-05');
|
||||
select * from t1 where (f1, f2) in (select f1, makedate(2011 , 125) from t1);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# lp:736791 Crash in make_truncated_value_warningwith LEAST()/GREATEST/COALESCE
|
||||
#
|
||||
create table t1 (f1 timestamp);
|
||||
insert into t1 values ('0000-00-00 00:00:00');
|
||||
select least(1, f1) from t1;
|
||||
drop table t1;
|
||||
|
||||
@@ -2221,6 +2221,7 @@ void Item_func_min_max::fix_length_and_dec()
|
||||
decimals=0;
|
||||
max_length=0;
|
||||
maybe_null=0;
|
||||
thd= current_thd;
|
||||
cmp_type=args[0]->result_type();
|
||||
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
@@ -2240,8 +2241,6 @@ void Item_func_min_max::fix_length_and_dec()
|
||||
if (cmp_type == STRING_RESULT)
|
||||
{
|
||||
agg_arg_charsets(collation, args, arg_count, MY_COLL_CMP_CONV, 1);
|
||||
if (compare_as_dates)
|
||||
thd= current_thd;
|
||||
}
|
||||
else if ((cmp_type == DECIMAL_RESULT) || (cmp_type == INT_RESULT))
|
||||
max_length= my_decimal_precision_to_length_no_truncation(max_int_part +
|
||||
|
||||
Reference in New Issue
Block a user