CREATE OR REPLACE TABLE t1 (
  a VARCHAR(32) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci
) partition by key(a) partitions 8;

DELIMITER $$
FOR i IN 0..0xFFFF
DO
  INSERT INTO t1 VALUES (CHAR(i USING utf32));
END FOR;
$$
DELIMITER ;

-- Can run these in parallel to speed-up:
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p0)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p1)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p2)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p3)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p4)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p5)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p6)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
SELECT HEX(t1.a), HEX(t2.a) FROM t1 partition (p7)  t1, t1 t2 WHERE (t1.a=t2.a) <> (UCASE(t1.a)=UCASE(t2.a));
