[MDEV-12619] UNION creates excessive integer column types for integer literals Created: 2017-04-28  Updated: 2018-05-31  Resolved: 2017-04-28

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.1, 10.2, 10.3
Fix Version/s: 10.3.1

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: datatype

Issue Links:
Blocks
blocks MDEV-4912 Data type plugin API version 1 Closed
Problem/Incident
causes MDEV-16347 Integer literal is typed as MYSQL_TYP... Closed
Relates
relates to MDEV-12613 UNION creates excessive integer colum... Open

 Description   

CREATE OR REPLACE TABLE t1 AS SELECT 1;
SHOW CREATE TABLE t1;

+-------+----------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                 |
+-------+----------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `1` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+----------------------------------------------------------------------------------------------+

CREATE OR REPLACE TABLE t1 AS SELECT 1 UNION SELECT 1;
SHOW CREATE TABLE t1;

+-------+--------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                     |
+-------+--------------------------------------------------------------------------------------------------+
| t1    | CREATE TABLE `t1` (
  `1` bigint(20) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+--------------------------------------------------------------------------------------------------+

Notice:

  • The first CREATE statement made a column of the int(1) type.
  • The second CREATE statement with UNION made a column the bigint(20) type. Looks excessive. An int column would be enough.


 Comments   
Comment by Alexander Barkov [ 2017-04-28 ]

Pushed to bb-10.2-ext

Generated at Thu Feb 08 07:59:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.