[MDEV-26129] Bad results with join comparing case insensitive VARCHAR/ENUM/SET expression to a _bin ENUM column Created: 2021-07-12  Updated: 2022-01-25  Resolved: 2022-01-18

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Data types
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.42, 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2, 10.8.1

Type: Bug Priority: Critical
Reporter: Sergei Golubchik Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6978 Bad results with join comparing case ... Closed
relates to MDEV-26128 type_set and type_enum are broken Closed

 Description   

CREATE TABLE t1 (a ENUM('a') CHARACTER SET latin1 PRIMARY KEY);
INSERT INTO t1 VALUES ('a');
CREATE TABLE t2 (a ENUM('a','A','b','B','c','C','d','D','e','E') CHARACTER SET latin1 COLLATE latin1_bin);
INSERT INTO t2 VALUES ('a'),('A');
-- without the following insert the bug doesn't show, was fixed in MDEV-6978
INSERT INTO t2 VALUES ('b'),('B'),('c'),('C'),('d'),('D'),('e'),('E');
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
DROP TABLE IF EXISTS t1,t2;

result

SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
res
a
SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
res
a

Correct result

SELECT t1.a res FROM t1 JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
res
a
a
SELECT t1.a res FROM t1 LEFT JOIN t2 ON t1.a COLLATE latin1_swedish_ci=t2.a;
res
a
a



 Comments   
Comment by Alexander Barkov [ 2022-01-18 ]

Setting priority to Critical, because this problem blocks MDEV-26128, which is critical.

Generated at Thu Feb 08 09:42:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.