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

CAST(char_col AS DOUBLE) prints redundant spaces in a warning

    XMLWordPrintable

Details

    Description

      CREATE OR REPLACE TABLE t1 (a CHAR(5) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci);
      INSERT INTO t1 VALUES ('1x'), ('x');
      SELECT a,CAST(a AS DOUBLE) FROM t1 ORDER BY a;
      

      +------+-------------------+
      | a    | CAST(a AS DOUBLE) |
      +------+-------------------+
      | 1x   |                 1 |
      | x    |                 0 |
      +------+-------------------+
      

      SHOW WARNINGS;
      

      +---------+------+----------------------------------------------------------+
      | Level   | Code | Message                                                  |
      +---------+------+----------------------------------------------------------+
      | Warning | 1292 | Truncated incorrect DOUBLE value: '1x                  ' |
      | Warning | 1292 | Truncated incorrect DOUBLE value: 'x                   ' |
      +---------+------+----------------------------------------------------------+
      

      Notice extra trailing spaces in the warning text. There should not be trailing spaces:

      • The column values are just '1x' and 'x' because sql_mode=PAD_CHAR_TO_FULL_LENGTH is not set.
      • Moreover, the number of trailing spaces is more than the column character length (which is 5).

      Attachments

        Issue Links

          Activity

            People

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