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

UNION / UNION ALL redefines tinyint(1) to tinyint(4)

    XMLWordPrintable

Details

    Description

      Using UNION and UNION ALL redefines datatypes from tinyint(1) to tinyint(4).

      How to do:

       
      mariadb> create table table_test (column_test_boolean tinyint(1));
      Query OK, 0 rows affected (0.07 sec)
       
      mariadb> insert into table_test (column_test_boolean) values (1), (0), (1);
      Query OK, 1 row affected (0.00 sec)
       
       
      mariadb> create table table_test_2 select * from table_test;
      Query OK, 0 rows affected (0.00 sec)
       
      mariadb> desc table_test_2
          -> ;
      +---------------------+------------+------+-----+---------+-------+
      | Field               | Type       | Null | Key | Default | Extra |
      +---------------------+------------+------+-----+---------+-------+
      | column_test_boolean | tinyint(1) | YES  |     | NULL    |       |
      +---------------------+------------+------+-----+---------+-------+
       
      mariadb> create table table_test_3 select * from table_test union all select * from table_test;
      Query OK, 0 rows affected (0.01 sec)
       
      mariadb> desc table_test_3;
      +---------------------+------------+------+-----+---------+-------+
      | Field               | Type       | Null | Key | Default | Extra |
      +---------------------+------------+------+-----+---------+-------+
      | column_test_boolean | tinyint(4) | YES  |     | NULL    |       |
      +---------------------+------------+------+-----+---------+-------+
      
      

      It occurs when opening the select, so it affects "select", "create table ... select", "creates view ... as select", ....
      The problem is that i use TinyInt(1) fields as boolean,
      so TinyInt(4) breaks my code.

      Attachments

        Activity

          People

            bar Alexander Barkov
            u.korn@comitware.de Uli Korn
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.