Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.0(EOL), 10.1(EOL), 10.2(EOL)
Description
CREATE OR REPLACE TABLE t1 AS SELECT COALESCE(10.1,CAST(10 AS UNSIGNED)) AS a;
|
SHOW CREATE TABLE t1;
|
returns
+-------+------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`a` decimal(3,1) NOT NULL DEFAULT '0.0'
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+------------------------------------------------------------------------------------------------------+
|
Now if I join the same arguments in UNION:
CREATE OR REPLACE TABLE t1 AS SELECT 10.1 AS a UNION SELECT CAST(10 AS UNSIGNED);
|
SHOW CREATE TABLE t1;
|
it returns:
+-------+-------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`a` decimal(18,1) NOT NULL DEFAULT '0.0'
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-------------------------------------------------------------------------------------------------------+
|
DECIMAL(18,1) for these arguments looks too huge.
UNION should create DECIMAL(3,1), like COALESCE does.
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12775 Reuse data type aggregation code for hybrid functions and UNION
- Closed