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
c32d3e16
Commit
c32d3e16
authored
Dec 07, 2016
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
parent
52b590bc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
97 additions
and
1 deletion
+97
-1
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+68
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+25
-0
sql/sql_time.cc
sql/sql_time.cc
+4
-1
No files found.
mysql-test/r/func_time.result
View file @
c32d3e16
...
@@ -2778,5 +2778,73 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00'
...
@@ -2778,5 +2778,73 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00'
Warning 1292 Truncated incorrect time value: '-1441:00:00'
Warning 1292 Truncated incorrect time value: '-1441:00:00'
Warning 1292 Truncated incorrect time value: '-1441:00:00'
Warning 1292 Truncated incorrect time value: '-1441:00:00'
#
#
# MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
#
CREATE TABLE t1 (d DATE);
INSERT INTO t1 VALUES ('2005-07-20'),('2012-12-21');
SELECT REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL 0.6732771076944444 HOUR_SECOND ), '2', 'x' )
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' ) FROM t1;
REPLACE( ADDDATE( d, INTERVAL '0.6732771076944444' HOUR_SECOND ), '2', 'x' )
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL 6732771076944444 SECOND) AS CHAR)
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '67327710769444:44' HOUR_SECOND) AS CHAR)
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
SELECT CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR) FROM t1;
CAST(ADDDATE( d, INTERVAL '673277107694:44:44' HOUR_SECOND) AS CHAR)
NULL
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
Warning 1441 Datetime function: datetime field overflow
DROP TABLE t1;
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:23:59:59' DAY_SECOND)
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:59:59' DAY_SECOND)
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:59' DAY_SECOND)
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:0:315569433599' DAY_SECOND)
9999-12-31 23:59:59
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '3652423:0:0:315569433559' DAY_SECOND)
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:87658175:0:315569433559' DAY_SECOND)
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
SELECT ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND);
ADDDATE(DATE'0000-01-01', INTERVAL '0:0:5259490559:315569433599' DAY_SECOND)
NULL
Warnings:
Warning 1441 Datetime function: datetime field overflow
#
# End of 10.0 tests
# End of 10.0 tests
#
#
mysql-test/t/func_time.test
View file @
c32d3e16
...
@@ -1705,6 +1705,31 @@ SELECT
...
@@ -1705,6 +1705,31 @@ SELECT
TIMEDIFF
(
20140101000000.000
,
20140302010000.000
)
AS
dec_dec
,
TIMEDIFF
(
20140101000000.000
,
20140302010000.000
)
AS
dec_dec
,
TIMEDIFF
(
20140101000000.000
,
'2014-03-02 01:00:00'
)
AS
dec_str
;
TIMEDIFF
(
20140101000000.000
,
'2014-03-02 01:00:00'
)
AS
dec_str
;
--
echo
#
--
echo
# MDEV-10787 Assertion `ltime->neg == 0' failed in void date_to_datetime(MYSQL_TIME*)
--
echo
#
CREATE
TABLE
t1
(
d
DATE
);
INSERT
INTO
t1
VALUES
(
'2005-07-20'
),(
'2012-12-21'
);
SELECT
REPLACE
(
ADDDATE
(
d
,
INTERVAL
0.6732771076944444
HOUR_SECOND
),
'2'
,
'x'
)
FROM
t1
;
SELECT
REPLACE
(
ADDDATE
(
d
,
INTERVAL
'0.6732771076944444'
HOUR_SECOND
),
'2'
,
'x'
)
FROM
t1
;
SELECT
CAST
(
ADDDATE
(
d
,
INTERVAL
6732771076944444
SECOND
)
AS
CHAR
)
FROM
t1
;
SELECT
CAST
(
ADDDATE
(
d
,
INTERVAL
'67327710769444:44'
HOUR_SECOND
)
AS
CHAR
)
FROM
t1
;
SELECT
CAST
(
ADDDATE
(
d
,
INTERVAL
'673277107694:44:44'
HOUR_SECOND
)
AS
CHAR
)
FROM
t1
;
DROP
TABLE
t1
;
# Maximum possible DAY_SECOND values in various formats
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'3652423:23:59:59'
DAY_SECOND
);
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'0:87658175:59:59'
DAY_SECOND
);
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'0:0:5259490559:59'
DAY_SECOND
);
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'0:0:0:315569433599'
DAY_SECOND
);
# Out-of-range INTERVAL DAY_SECOND values
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'3652423:0:0:315569433559'
DAY_SECOND
);
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'0:87658175:0:315569433559'
DAY_SECOND
);
SELECT
ADDDATE
(
DATE
'0000-01-01'
,
INTERVAL
'0:0:5259490559:315569433599'
DAY_SECOND
);
--
echo
#
--
echo
#
--
echo
# End of 10.0 tests
--
echo
# End of 10.0 tests
--
echo
#
--
echo
#
sql/sql_time.cc
View file @
c32d3e16
...
@@ -930,7 +930,10 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
...
@@ -930,7 +930,10 @@ bool date_add_interval(MYSQL_TIME *ltime, interval_type int_type,
my_bool
neg
=
0
;
my_bool
neg
=
0
;
enum
enum_mysql_timestamp_type
time_type
=
ltime
->
time_type
;
enum
enum_mysql_timestamp_type
time_type
=
ltime
->
time_type
;
if
((
ulong
)
interval
.
day
>
MAX_DAY_NUMBER
)
if
(((
ulonglong
)
interval
.
day
+
(
ulonglong
)
interval
.
hour
/
24
+
(
ulonglong
)
interval
.
minute
/
24
/
60
+
(
ulonglong
)
interval
.
second
/
24
/
60
/
60
)
>
MAX_DAY_NUMBER
)
goto
invalid_date
;
goto
invalid_date
;
if
(
time_type
!=
MYSQL_TIMESTAMP_TIME
)
if
(
time_type
!=
MYSQL_TIMESTAMP_TIME
)
...
...
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