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

Wrong number of decimal digits in certain UNION/Subqery constellation

    XMLWordPrintable

Details

    Description

      UNION of an UNSIGNED result, and a NULL result from a subquery, leads to wrong number of decimals. See the following two one liner test queries, which were run with `mysql --column-type-info`. This only started with 10.3.

      MariaDB [test]> select CAST(1 as unsigned) union all select NULL;
      Field   1:  `CAST(1 as unsigned)`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       NEWDECIMAL
      Collation:  binary (63)
      Length:     2
      Max_length: 1
      Decimals:   0
      Flags:      BINARY NUM 
       
       
      +---------------------+
      | CAST(1 as unsigned) |
      +---------------------+
      |                   1 |
      |                NULL |
      +---------------------+
      2 rows in set (0.000 sec)
       
      MariaDB [test]> select CAST(1 as unsigned) union all select * from (select NULL) t;
      Field   1:  `CAST(1 as unsigned)`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       NEWDECIMAL
      Collation:  binary (63)
      Length:     42
      Max_length: 40
      Decimals:   39
      Flags:      BINARY NUM 
       
       
      +------------------------------------------+
      | CAST(1 as unsigned)                      |
      +------------------------------------------+
      | 1.00000000000000000000000000000000000000 |
      |                                     NULL |
      +------------------------------------------+
      2 rows in set (0.000 sec)
      
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              hholzgra Hartmut Holzgraefe
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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