Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12619

UNION creates excessive integer column types for integer literals

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1, 10.2, 10.3
    • Fix Version/s: 10.3.1
    • Component/s: OTHER
    • Labels:

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: