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

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.8
    • Component/s: Character Sets
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: