[MDEV-13118] Wrong results with LOWER and UPPER and subquery Created: 2017-06-19  Updated: 2018-07-19  Resolved: 2018-07-19

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.0, 10.1, 10.2, 10.3
Fix Version/s: 10.0.36, 10.1.35, 10.2.17, 10.3.9, 10.4.0

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-10306 Wrong results with combination of CON... Closed

 Description   

This problem is similar to MDEV-10306

This script:

SET optimizer_switch=_utf8'derived_merge=on';
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1);
INSERT INTO t1 VALUES('abcdefghi');
SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;

returns a wrong result:

+--------------------+
| c2                 |
+--------------------+
| abcdefghiabcdefghi |
+--------------------+

Notice, there is no the expected dash character in the result.

The same problem is repeatable with UPPER:

SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;

+--------------------+
| c2                 |
+--------------------+
| ABCDEFGHIABCDEFGHI |
+--------------------+


Generated at Thu Feb 08 08:03:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.