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

EXPLAIN SELECT prints unexpected characters

Details

    • 10.1.8-2, 10.1.8-3

    Description

      In this script:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
      INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
      explain EXTENDED SELECT * FROM t1 WHERE
        COALESCE(c,0)='3 ' AND
        COALESCE(d,0)=COALESCE(c,0);
      SHOW WARNINGS;

      the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
      It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

      +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                                                                                                                                                     |
      +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | Note  | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥'))   |
      +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      Notice the unexpected YEN signs in the above output.

      Attachments

        Activity

          bar Alexander Barkov created issue -
          bar Alexander Barkov made changes -
          Field Original Value New Value
          Description In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:
          {format}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {format}
          In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

          {format}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {format}
          bar Alexander Barkov made changes -
          Description In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

          {format}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {format}
          In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

          {noformat}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {noformat}
          bar Alexander Barkov made changes -
          Description In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

          {noformat}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {noformat}
          In this script:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a DECIMAL(10,1),b DECIMAL(10,1),c VARCHAR(10),d VARCHAR(10));
          INSERT INTO t1 VALUES (1.5,1.5,'1','1'),(3.5,3.5,'3','3');
          explain EXTENDED SELECT * FROM t1 WHERE
            COALESCE(c,0)='3 ' AND
            COALESCE(d,0)=COALESCE(c,0);
          SHOW WARNINGS;
          {code}
          the condition gets rewritten by optimizer by replacing COALESCE(c,0) to '3'.
          It seems something goes wrong with the created replacement Item corresponding to '3', so the warnings generated by the EXPLAIN query return dirty characters:

          {noformat}
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t1`.`d` AS `d` from `test`.`t1` where ((coalesce(`test`.`t1`.`c`,0) = '3 ') and (coalesce(`test`.`t1`.`d`,0) = '¥¥')) |
          +-------+------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {noformat}
          Notice the unexpected YEN signs in the above output.
          bar Alexander Barkov made changes -
          Rank Ranked higher
          bar Alexander Barkov made changes -
          Rank Ranked higher
          bar Alexander Barkov made changes -
          Sprint 10.1.8-2 [ 14 ]
          bar Alexander Barkov made changes -
          Rank Ranked higher
          bar Alexander Barkov made changes -
          Fix Version/s 10.1.8 [ 19605 ]
          Fix Version/s 10.1 [ 16100 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          bar Alexander Barkov made changes -
          Sprint 10.1.8-2 [ 14 ] 10.1.8-2, 10.1.8-3 [ 14, 15 ]
          bar Alexander Barkov made changes -
          Labels upstream-not-affected

          MySQL-5.7.8-rc-debug is not affected

          bar Alexander Barkov added a comment - MySQL-5.7.8-rc-debug is not affected
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 69808 ] MariaDB v4 [ 149229 ]

          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.