mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Bug#29555: Comparing time values as strings may lead to a wrong result.
Time values were compared as strings. This led to a wrong comparison result when comparing values one of which is under 100 hours and another is over 100 hours. Now when the Arg_comparator::set_cmp_func function sees that both items to compare are of the TIME type it sets the comparator to the Arg_comparator::compare_e_int or the Arg_comparator::compare_int_unsigned functions.
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user