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

Wrong UNSIGNED metadata flag returned for COALESCE(unsigned_field,timestamp_field)

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5(EOL), 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5.0
    • Data types
    • None

    Description

      I run this command

      mysql --column-type-info test
      

      and execute the following script:

      CREATE OR REPLACE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
      SELECT COALESCE(a,b) FROM t1;
      

      Field   1:  `COALESCE(a,b)`
      Catalog:    `def`
      Database:   ``
      Table:      ``
      Org_table:  ``
      Type:       VAR_STRING
      Collation:  utf8_general_ci (33)
      Length:     57
      Max_length: 0
      Decimals:   39
      Flags:      UNSIGNED
      

      Note, in prints the UNSIGNED flag, although this flag is not applicable to VAR_STRING.

      Note, this script correctly creates a column of the VARCHAR data type without any UNSIGNED flags:

      CREATE OR REPLACE TABLE t1 (a INT UNSIGNED, b TIMESTAMP);
      CREATE OR REPLACE TABLE t2 AS SELECT COALESCE(a,b) AS c FROM t1;
      SHOW CREATE TABLE t2;
      

      +-------+--------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                 |
      +-------+--------------------------------------------------------------------------------------------------------------+
      | t2    | CREATE TABLE `t2` (
        `c` varchar(19) CHARACTER SET utf8 DEFAULT NULL
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+--------------------------------------------------------------------------------------------------------------+
      

      Result field metadata should be fixed to match the column type created in CREATE..SELECT.

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.