mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
This commit is contained in:
parent
0c6455aa46
commit
935a163dd9
3 changed files with 145 additions and 3 deletions
|
@ -2706,5 +2706,118 @@ Warning 1292 Truncated incorrect time value: '9223372036854775807:00:00'
|
|||
Warning 1292 Truncated incorrect time value: '-9223372036854775808:00:00'
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
|
||||
#
|
||||
SELECT MAKETIME(900,0,0);
|
||||
MAKETIME(900,0,0)
|
||||
838:59:59
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.1);
|
||||
MAKETIME(900,0,0.1)
|
||||
838:59:59.9
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.11);
|
||||
MAKETIME(900,0,0.11)
|
||||
838:59:59.99
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.111);
|
||||
MAKETIME(900,0,0.111)
|
||||
838:59:59.999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.1111);
|
||||
MAKETIME(900,0,0.1111)
|
||||
838:59:59.9999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.11111);
|
||||
MAKETIME(900,0,0.11111)
|
||||
838:59:59.99999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.111111);
|
||||
MAKETIME(900,0,0.111111)
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.1111111);
|
||||
MAKETIME(900,0,0.1111111)
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.11111111);
|
||||
MAKETIME(900,0,0.11111111)
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,0.111111111);
|
||||
MAKETIME(900,0,0.111111111)
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:00'
|
||||
SELECT MAKETIME(900,0,EXP(1));
|
||||
MAKETIME(900,0,EXP(1))
|
||||
838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '900:00:02'
|
||||
SELECT MAKETIME(-900,0,0);
|
||||
MAKETIME(-900,0,0)
|
||||
-838:59:59
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.1);
|
||||
MAKETIME(-900,0,0.1)
|
||||
-838:59:59.9
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.11);
|
||||
MAKETIME(-900,0,0.11)
|
||||
-838:59:59.99
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.111);
|
||||
MAKETIME(-900,0,0.111)
|
||||
-838:59:59.999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.1111);
|
||||
MAKETIME(-900,0,0.1111)
|
||||
-838:59:59.9999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.11111);
|
||||
MAKETIME(-900,0,0.11111)
|
||||
-838:59:59.99999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.111111);
|
||||
MAKETIME(-900,0,0.111111)
|
||||
-838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.1111111);
|
||||
MAKETIME(-900,0,0.1111111)
|
||||
-838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.11111111);
|
||||
MAKETIME(-900,0,0.11111111)
|
||||
-838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,0.111111111);
|
||||
MAKETIME(-900,0,0.111111111)
|
||||
-838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:00'
|
||||
SELECT MAKETIME(-900,0,EXP(1));
|
||||
MAKETIME(-900,0,EXP(1))
|
||||
-838:59:59.999999
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect time value: '-900:00:02'
|
||||
#
|
||||
# End of 5.5 tests
|
||||
#
|
||||
|
|
|
@ -1654,6 +1654,34 @@ INSERT INTO t1 VALUES (1e30),(-1e30);
|
|||
SELECT MAKETIME(a,0,0) FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
|
||||
--echo #
|
||||
|
||||
SELECT MAKETIME(900,0,0);
|
||||
SELECT MAKETIME(900,0,0.1);
|
||||
SELECT MAKETIME(900,0,0.11);
|
||||
SELECT MAKETIME(900,0,0.111);
|
||||
SELECT MAKETIME(900,0,0.1111);
|
||||
SELECT MAKETIME(900,0,0.11111);
|
||||
SELECT MAKETIME(900,0,0.111111);
|
||||
SELECT MAKETIME(900,0,0.1111111);
|
||||
SELECT MAKETIME(900,0,0.11111111);
|
||||
SELECT MAKETIME(900,0,0.111111111);
|
||||
SELECT MAKETIME(900,0,EXP(1));
|
||||
|
||||
SELECT MAKETIME(-900,0,0);
|
||||
SELECT MAKETIME(-900,0,0.1);
|
||||
SELECT MAKETIME(-900,0,0.11);
|
||||
SELECT MAKETIME(-900,0,0.111);
|
||||
SELECT MAKETIME(-900,0,0.1111);
|
||||
SELECT MAKETIME(-900,0,0.11111);
|
||||
SELECT MAKETIME(-900,0,0.111111);
|
||||
SELECT MAKETIME(-900,0,0.1111111);
|
||||
SELECT MAKETIME(-900,0,0.11111111);
|
||||
SELECT MAKETIME(-900,0,0.111111111);
|
||||
SELECT MAKETIME(-900,0,EXP(1));
|
||||
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.5 tests
|
||||
|
|
|
@ -2765,9 +2765,10 @@ bool Item_func_maketime::get_date(MYSQL_TIME *ltime, ulonglong fuzzy_date)
|
|||
}
|
||||
else
|
||||
{
|
||||
ltime->hour= TIME_MAX_HOUR;
|
||||
ltime->minute= TIME_MAX_MINUTE;
|
||||
ltime->second= TIME_MAX_SECOND;
|
||||
// use check_time_range() to set ltime to the max value depending on dec
|
||||
int unused;
|
||||
ltime->hour= TIME_MAX_HOUR + 1;
|
||||
check_time_range(ltime, decimals, &unused);
|
||||
char buf[28];
|
||||
char *ptr= longlong10_to_str(hour.value(), buf, hour.is_unsigned() ? 10 : -10);
|
||||
int len = (int)(ptr - buf) + sprintf(ptr, ":%02u:%02u", (uint)minute, (uint)second);
|
||||
|
|
Loading…
Reference in a new issue