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

Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.1(EOL)
    • 10.1.8
    • Character Sets
    • None

    Description

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10));
      INSERT INTO t1 VALUES ('a'),('b');
      EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;

      returns:

      +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | EXPLAIN                                                                                                                                                                                                             |
      +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | {
        "query_block": {
          "select_id": 1,
          "table": {
            "table_name": "t1",
            "access_type": "ALL",
            "rows": 1,
            "filtered": 100,
            "attached_condition": "(t1.a = _latin1'�')"
          }
        }
      }  |
      +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

      Notice some garbage in the output.

      EXPLAIN EXTENDED in for the same thing:

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10));
      EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=_latin1 0xDF;
      SHOW WARNINGS;

      produces a result without garbage:

      +-------+------+----------------------------------------------------------------------------------------+
      | Level | Code | Message                                                                                |
      +-------+------+----------------------------------------------------------------------------------------+
      | Note  | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = _latin1'\xDF') |
      +-------+------+----------------------------------------------------------------------------------------+

      Perhaps FORMAT=JSON should use the same style for output.

      Attachments

        Activity

          bar Alexander Barkov created issue -
          bar Alexander Barkov made changes -
          Field Original Value New Value
          Description {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a VARCHAR(10));
          EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
          {code}
          returns:
          {noformat}
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | EXPLAIN |
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | {
            "query_block": {
              "select_id": 1,
              "table": {
                "table_name": "t1",
                "access_type": "ALL",
                "rows": 1,
                "filtered": 100,
                "attached_condition": "(t1.a = _latin1'�')"
              }
            }
          } |
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {noformat}
          Notice some garbage in the output.

          EXPLAIN EXTENDED in for the same thing:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a VARCHAR(10));
          EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=_latin1 0xDF;
          SHOW WARNINGS;
          {code}
          produces a result without garbage:
          {noformat}
          +-------+------+----------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+----------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = _latin1'\xDF') |
          +-------+------+----------------------------------------------------------------------------------------+
          {noformat}

          Perhaps FORMAT=JSON should use the same style for output.
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a VARCHAR(10));
          INSERT INTO t1 VALUES ('a'),('b');
          EXPLAIN FORMAT=JSON SELECT * FROM t1 WHERE a=_latin1 0xDF;
          {code}
          returns:
          {noformat}
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | EXPLAIN |
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          | {
            "query_block": {
              "select_id": 1,
              "table": {
                "table_name": "t1",
                "access_type": "ALL",
                "rows": 1,
                "filtered": 100,
                "attached_condition": "(t1.a = _latin1'�')"
              }
            }
          } |
          +---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
          {noformat}
          Notice some garbage in the output.

          EXPLAIN EXTENDED in for the same thing:
          {code}
          DROP TABLE IF EXISTS t1;
          CREATE TABLE t1 (a VARCHAR(10));
          EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=_latin1 0xDF;
          SHOW WARNINGS;
          {code}
          produces a result without garbage:
          {noformat}
          +-------+------+----------------------------------------------------------------------------------------+
          | Level | Code | Message |
          +-------+------+----------------------------------------------------------------------------------------+
          | Note | 1003 | select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = _latin1'\xDF') |
          +-------+------+----------------------------------------------------------------------------------------+
          {noformat}

          Perhaps FORMAT=JSON should use the same style for output.
          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 ]
          serg Sergei Golubchik made changes -
          Component/s Character Sets [ 10801 ]
          Component/s OTHER [ 10125 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 71515 ] MariaDB v4 [ 149604 ]

          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.