mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 02:51:44 +01:00
Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into moonbone.local:/mnt/gentoo64/work/29555-bug-5.0-opt-mysql
This commit is contained in:
commit
2b4810030b
3 changed files with 40 additions and 0 deletions
|
@ -85,3 +85,21 @@ sec_to_time(time_to_sec(t))
|
|||
13:00:00
|
||||
09:00:00
|
||||
drop table t1;
|
||||
select cast('100:55:50' as time) < cast('24:00:00' as time);
|
||||
cast('100:55:50' as time) < cast('24:00:00' as time)
|
||||
0
|
||||
select cast('100:55:50' as time) < cast('024:00:00' as time);
|
||||
cast('100:55:50' as time) < cast('024:00:00' as time)
|
||||
0
|
||||
select cast('300:55:50' as time) < cast('240:00:00' as time);
|
||||
cast('300:55:50' as time) < cast('240:00:00' as time)
|
||||
0
|
||||
select cast('100:55:50' as time) > cast('24:00:00' as time);
|
||||
cast('100:55:50' as time) > cast('24:00:00' as time)
|
||||
1
|
||||
select cast('100:55:50' as time) > cast('024:00:00' as time);
|
||||
cast('100:55:50' as time) > cast('024:00:00' as time)
|
||||
1
|
||||
select cast('300:55:50' as time) > cast('240:00:00' as time);
|
||||
cast('300:55:50' as time) > cast('240:00:00' as time)
|
||||
1
|
||||
|
|
|
@ -40,3 +40,13 @@ drop table t1;
|
|||
# ##########################################################
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#29555: Comparing time values as strings may lead to a wrong result.
|
||||
#
|
||||
select cast('100:55:50' as time) < cast('24:00:00' as time);
|
||||
select cast('100:55:50' as time) < cast('024:00:00' as time);
|
||||
select cast('300:55:50' as time) < cast('240:00:00' as time);
|
||||
select cast('100:55:50' as time) > cast('24:00:00' as time);
|
||||
select cast('100:55:50' as time) > cast('024:00:00' as time);
|
||||
select cast('300:55:50' as time) > cast('240:00:00' as time);
|
||||
|
|
|
@ -706,6 +706,18 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
|
|||
func= &Arg_comparator::compare_datetime;
|
||||
return 0;
|
||||
}
|
||||
else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
|
||||
(*b)->field_type() == MYSQL_TYPE_TIME)
|
||||
{
|
||||
/* Compare TIME values as integers. */
|
||||
thd= current_thd;
|
||||
owner= owner_arg;
|
||||
func= ((test(owner && owner->functype() == Item_func::EQUAL_FUNC)) ?
|
||||
&Arg_comparator::compare_e_int :
|
||||
&Arg_comparator::compare_int_unsigned);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return set_compare_func(owner_arg, type);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue