[MDEV-8786] Wrong result for SELECT FORMAT=JSON * FROM t1 WHERE a=_latin1 0xDF Created: 2015-09-10  Updated: 2015-09-14  Resolved: 2015-09-10

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.1
Fix Version/s: 10.1.8

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
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.


Generated at Thu Feb 08 07:29:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.