Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2(EOL), 10.3(EOL)
-
None
Description
This query:
SELECT
|
LEAST(DATE'2001-01-01', TIME'10:20:30') AS c1, |
CONCAT(LEAST(DATE'2001-01-01', TIME'10:20:30')) AS c2; |
returns a good result:
+---------------------+---------------------+
|
| c1 | c2 |
|
+---------------------+---------------------+
|
| 2001-01-01 00:00:00 | 2001-01-01 00:00:00 |
|
+---------------------+---------------------+
|
Now I try the same query in CREATE..SELECT
DROP TABLE IF EXISTS t1; |
SET sql_mode=''; |
CREATE TABLE t1 AS SELECT |
LEAST(DATE'2001-01-01', TIME'10:20:30') AS c1, |
CONCAT(LEAST(DATE'2001-01-01', TIME'10:20:30')) AS c2; |
SHOW WARNINGS;
|
SELECT * FROM t1; |
It returns a warning:
+---------+------+-----------------------------------------+
|
| Level | Code | Message |
|
+---------+------+-----------------------------------------+
|
| Warning | 1265 | Data truncated for column 'c2' at row 1 |
|
+---------+------+-----------------------------------------+
|
And this result set:
+---------------------+------------+
|
| c1 | c2 |
|
+---------------------+------------+
|
| 2001-01-01 00:00:00 | 2001-01-01 |
|
+---------------------+------------+
|
Notice, the c2 value was truncated.
Now I do:
SHOW CREATE TABLE t1; |
+-------+-------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`c1` datetime NOT NULL,
|
`c2` varchar(10) CHARACTER SET utf8 NOT NULL
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------------+
|
Notice, the data type for the column c2 is too short.
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12506 Split Item_func_min_max::fix_length_and_dec() into methods in Type_handler
- Closed