[MDEV-8253] EXPLAIN SELECT prints unexpected characters Created: 2015-06-01  Updated: 2015-09-23  Resolved: 2015-09-23

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

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: upstream-not-affected

Sprint: 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.



 Comments   
Comment by Alexander Barkov [ 2015-09-23 ]

MySQL-5.7.8-rc-debug is not affected

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