Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
935a163d
Commit
935a163d
authored
Sep 20, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result
parent
0c6455aa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
145 additions
and
3 deletions
+145
-3
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+113
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+28
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+4
-3
No files found.
mysql-test/r/func_time.result
View file @
935a163d
...
...
@@ -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
#
mysql-test/t/func_time.test
View file @
935a163d
...
...
@@ -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
...
...
sql/item_timefunc.cc
View file @
935a163d
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment