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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
5d7b97b8
Commit
5d7b97b8
authored
Sep 16, 2013
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10')
parent
996f6194
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
1 deletion
+102
-1
mysql-test/r/func_time.result
mysql-test/r/func_time.result
+64
-0
mysql-test/t/func_time.test
mysql-test/t/func_time.test
+36
-0
sql/item_timefunc.cc
sql/item_timefunc.cc
+2
-1
No files found.
mysql-test/r/func_time.result
View file @
5d7b97b8
...
@@ -2177,3 +2177,67 @@ Warning 1292 Truncated incorrect DECIMAL value: 'xxx'
...
@@ -2177,3 +2177,67 @@ Warning 1292 Truncated incorrect DECIMAL value: 'xxx'
SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00');
SELECT CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00');
CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00')
CONVERT_TZ('2001-01-01 10:20:30.12','+00:00','+01:00')
2001-01-01 11:20:30.12
2001-01-01 11:20:30.12
#
# MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10')
#
CREATE TABLE t1 AS SELECT
TIMESTAMP('2001-01-01','10:10:10'),
TIMESTAMP('2001-01-01','10:10:10.1'),
TIMESTAMP('2001-01-01','10:10:10.12'),
TIMESTAMP('2001-01-01','10:10:10.123'),
TIMESTAMP('2001-01-01','10:10:10.1234'),
TIMESTAMP('2001-01-01','10:10:10.12345'),
TIMESTAMP('2001-01-01','10:10:10.123456'),
TIMESTAMP('2001-01-01','10:10:10.1234567');
Warnings:
Warning 1292 Truncated incorrect time value: '10:10:10.1234567'
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
TIMESTAMP('2001-01-01','10:10:10') datetime YES NULL
TIMESTAMP('2001-01-01','10:10:10.1') datetime(1) YES NULL
TIMESTAMP('2001-01-01','10:10:10.12') datetime(2) YES NULL
TIMESTAMP('2001-01-01','10:10:10.123') datetime(3) YES NULL
TIMESTAMP('2001-01-01','10:10:10.1234') datetime(4) YES NULL
TIMESTAMP('2001-01-01','10:10:10.12345') datetime(5) YES NULL
TIMESTAMP('2001-01-01','10:10:10.123456') datetime(6) YES NULL
TIMESTAMP('2001-01-01','10:10:10.1234567') datetime(6) YES NULL
SELECT * FROM t1;
TIMESTAMP('2001-01-01','10:10:10') TIMESTAMP('2001-01-01','10:10:10.1') TIMESTAMP('2001-01-01','10:10:10.12') TIMESTAMP('2001-01-01','10:10:10.123') TIMESTAMP('2001-01-01','10:10:10.1234') TIMESTAMP('2001-01-01','10:10:10.12345') TIMESTAMP('2001-01-01','10:10:10.123456') TIMESTAMP('2001-01-01','10:10:10.1234567')
2001-01-01 10:10:10 2001-01-01 10:10:10.1 2001-01-01 10:10:10.12 2001-01-01 10:10:10.123 2001-01-01 10:10:10.1234 2001-01-01 10:10:10.12345 2001-01-01 10:10:10.123456 2001-01-01 10:10:10.123456
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
TIMESTAMP('2001-01-01 00:00:00','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.1','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.12','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.123','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.1234','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.12345','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.123456','10:10:10'),
TIMESTAMP('2001-01-01 00:00:00.1234567','10:10:10');
Warnings:
Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00.1234567'
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
TIMESTAMP('2001-01-01 00:00:00','10:10:10') datetime YES NULL
TIMESTAMP('2001-01-01 00:00:00.1','10:10:10') datetime(1) YES NULL
TIMESTAMP('2001-01-01 00:00:00.12','10:10:10') datetime(2) YES NULL
TIMESTAMP('2001-01-01 00:00:00.123','10:10:10') datetime(3) YES NULL
TIMESTAMP('2001-01-01 00:00:00.1234','10:10:10') datetime(4) YES NULL
TIMESTAMP('2001-01-01 00:00:00.12345','10:10:10') datetime(5) YES NULL
TIMESTAMP('2001-01-01 00:00:00.123456','10:10:10') datetime(6) YES NULL
TIMESTAMP('2001-01-01 00:00:00.1234567','10:10:10') datetime(6) YES NULL
SELECT * FROM t1;
TIMESTAMP('2001-01-01 00:00:00','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1','10:10:10') TIMESTAMP('2001-01-01 00:00:00.12','10:10:10') TIMESTAMP('2001-01-01 00:00:00.123','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1234','10:10:10') TIMESTAMP('2001-01-01 00:00:00.12345','10:10:10') TIMESTAMP('2001-01-01 00:00:00.123456','10:10:10') TIMESTAMP('2001-01-01 00:00:00.1234567','10:10:10')
2001-01-01 10:10:10 2001-01-01 10:10:10.1 2001-01-01 10:10:10.12 2001-01-01 10:10:10.123 2001-01-01 10:10:10.1234 2001-01-01 10:10:10.12345 2001-01-01 10:10:10.123456 2001-01-01 10:10:10.123456
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
TIMESTAMP('00:00:00','10:10:10'),
TIMESTAMP(TIME('00:00:00'),'10:10:10');
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
TIMESTAMP('00:00:00','10:10:10') datetime YES NULL
TIMESTAMP(TIME('00:00:00'),'10:10:10') datetime YES NULL
SELECT * FROM t1;
TIMESTAMP('00:00:00','10:10:10') TIMESTAMP(TIME('00:00:00'),'10:10:10')
NULL NULL
DROP TABLE t1;
mysql-test/t/func_time.test
View file @
5d7b97b8
...
@@ -1321,3 +1321,39 @@ SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND);
...
@@ -1321,3 +1321,39 @@ SELECT DATE_ADD('2001-01-01 00:00:00', INTERVAL -1.12345 SECOND);
SELECT
DATE_ADD
(
'2001-01-01 00:00:00'
,
INTERVAL
-
1.123456
SECOND
);
SELECT
DATE_ADD
(
'2001-01-01 00:00:00'
,
INTERVAL
-
1.123456
SECOND
);
SELECT
DATE_ADD
(
'2001-01-01 00:00:00'
,
INTERVAL
'xxx'
SECOND
);
SELECT
DATE_ADD
(
'2001-01-01 00:00:00'
,
INTERVAL
'xxx'
SECOND
);
SELECT
CONVERT_TZ
(
'2001-01-01 10:20:30.12'
,
'+00:00'
,
'+01:00'
);
SELECT
CONVERT_TZ
(
'2001-01-01 10:20:30.12'
,
'+00:00'
,
'+01:00'
);
--
echo
#
--
echo
# MDEV-4843 Wrong data type for TIMESTAMP('2001-01-01','10:10:10')
--
echo
#
CREATE
TABLE
t1
AS
SELECT
TIMESTAMP
(
'2001-01-01'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.1'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.12'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.123'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.1234'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.12345'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.123456'
),
TIMESTAMP
(
'2001-01-01'
,
'10:10:10.1234567'
);
SHOW
COLUMNS
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
AS
SELECT
TIMESTAMP
(
'2001-01-01 00:00:00'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.1'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.12'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.123'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.1234'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.12345'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.123456'
,
'10:10:10'
),
TIMESTAMP
(
'2001-01-01 00:00:00.1234567'
,
'10:10:10'
);
SHOW
COLUMNS
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
CREATE
TABLE
t1
AS
SELECT
TIMESTAMP
(
'00:00:00'
,
'10:10:10'
),
TIMESTAMP
(
TIME
(
'00:00:00'
),
'10:10:10'
);
SHOW
COLUMNS
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
sql/item_timefunc.cc
View file @
5d7b97b8
...
@@ -2435,7 +2435,8 @@ void Item_func_add_time::fix_length_and_dec()
...
@@ -2435,7 +2435,8 @@ void Item_func_add_time::fix_length_and_dec()
arg0_field_type
=
args
[
0
]
->
field_type
();
arg0_field_type
=
args
[
0
]
->
field_type
();
if
(
arg0_field_type
==
MYSQL_TYPE_DATE
||
if
(
arg0_field_type
==
MYSQL_TYPE_DATE
||
arg0_field_type
==
MYSQL_TYPE_DATETIME
||
arg0_field_type
==
MYSQL_TYPE_DATETIME
||
arg0_field_type
==
MYSQL_TYPE_TIMESTAMP
)
arg0_field_type
==
MYSQL_TYPE_TIMESTAMP
||
is_date
)
{
{
cached_field_type
=
MYSQL_TYPE_DATETIME
;
cached_field_type
=
MYSQL_TYPE_DATETIME
;
decimals
=
max
(
args
[
0
]
->
temporal_precision
(
MYSQL_TYPE_DATETIME
),
decimals
=
max
(
args
[
0
]
->
temporal_precision
(
MYSQL_TYPE_DATETIME
),
...
...
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