Bug #115466 Incorrect identification of duplicate primary keys
Submitted: 30 Jun 2024 14:52 Modified: 1 Jul 2024 9:58
Reporter: ru tu Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:8.4.0 OS:Any
Assigned to: CPU Architecture:Any

[30 Jun 2024 14:52] ru tu
Description:
CREATE TABLE test (c1 VARCHAR(255), PRIMARY KEY(c1));
INSERT INTO test(c1) VALUES ('A');
INSERT INTO test(c1) VALUES ('a');

When inserting a, it will report a duplicate primary key. But there's only 'A' in the table and there's no 'a'.

How to repeat:
CREATE TABLE test (c1 VARCHAR(255), PRIMARY KEY(c1));
INSERT INTO test(c1) VALUES ('A');
INSERT INTO test(c1) VALUES ('a');
--ERROR 1062 (23000): Duplicate entry 'a' for key 'test.PRIMARY'
[1 Jul 2024 9:58] MySQL Verification Team
Hi Mr. tu,

Thank you for your bug report.

However, this is not a bug.

You have probably selected a case-insensitive default collation.

We have selected a case-sensitive collation and we had not problems of inserting 'a' and "A' in two rows.

That is why you get those results.

Please, check it out.

Not a bug.