Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1(EOL), 10.2(EOL), 10.3(EOL)
Description
CREATE OR REPLACE TABLE t1 AS SELECT 1, 'a' AS c1 UNION SELECT 'a', 1; |
SHOW CREATE TABLE t1; |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
`c1` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT ''
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
Notice:
- INT+CHAR created a varchar(1) column
- CHAR+INT created a varchar(20) column
Note, if I mix the same expression in hybrid functions, the results are symmetric:
CREATE OR REPLACE TABLE t1 AS SELECT COALESCE(1,'a'), COALESCE('a',1); |
SHOW CREATE TABLE t1; |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| Table | Create Table |
|
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
| t1 | CREATE TABLE `t1` (
|
`COALESCE(1,'a')` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
|
`COALESCE('a',1)` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT ''
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
|
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
Attachments
Issue Links
- blocks
-
MDEV-4912 Data type plugin API version 1
- Closed
- relates to
-
MDEV-12594 UNION between fixed length double columns does not always preserve scale
- Closed
-
MDEV-12595 UNION converts INT to BIGINT
- Closed
-
MDEV-12775 Reuse data type aggregation code for hybrid functions and UNION
- Closed