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

Wrong data type for LEAST(latin1_expr, utf8_expr)

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL)
    • 10.3.1
    • Character Sets

    Description

      CREATE OR REPLACE TABLE t1 AS SELECT
        LEAST(_latin1'aaa',_utf8 0xC39F) AS c1,
        COALESCE(_latin1'aaa',_utf8 0xC39F) AS c2;
      SHOW WARNINGS;
      SHOW CREATE TABLE t1;
      SELECT * FROM t1;
      

      returns a warning:

      +---------+------+-----------------------------------------+
      | Level   | Code | Message                                 |
      +---------+------+-----------------------------------------+
      | Warning | 1265 | Data truncated for column 'c1' at row 1 |
      +---------+------+-----------------------------------------+
      

      and this result:

      +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Table | Create Table                                                                                                                                                                  |
      +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | t1    | CREATE TABLE `t1` (
        `c1` varchar(1) CHARACTER SET utf8 NOT NULL DEFAULT '',
        `c2` varchar(3) CHARACTER SET utf8 NOT NULL DEFAULT ''
      ) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
      +-------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      +----+-----+
      | c1 | c2  |
      +----+-----+
      | a  | aaa |
      +----+-----+
      

      Notice:

      • The data type for column c1 is wrong. It should be varchar(3)), similar to c2
      • The result for column c1 is wrong. It should be aaa.

      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.