[MDEV-23507] Wrong duplicate key value printed in ER_DUP_ENTRY Created: 2020-08-18  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Aria, Storage Engine - MyISAM
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4, 10.5

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-25741 Wrong warning on duplicate keys Closed

 Description   

I am keeping it as Major, despite it being "just" a wrong error message, because it can be important for problem diagnostics on users' side. From time to time we receive complaints of the kind "I got the error 'Duplicate key xx', but there is no duplicate xx in my table" (in various circumstances). It is difficult to investigate such problems as the real data can be dynamic, so we often consider it a user error. But it turns out the error message can be simply wrong.

--source include/have_sequence.inc
 
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 
INSERT INTO t1 VALUES (8);
INSERT INTO t1 SELECT seq FROM seq_1_to_100;
 
--error ER_DUP_ENTRY 
ALTER TABLE t1 ADD UNIQUE (a);
 
# Cleanup
DROP TABLE t1;

10.2 3e617b8b

MariaDB [test]> ALTER TABLE t1 ADD UNIQUE (a);
ERROR 1062 (23000): Duplicate entry '100' for key 'a'

The error ER_DUP_ENTRY itself isn't wrong, there is a duplicate entry in there; but it's not 100, it is 8.

Also reproducible with Aria.



 Comments   
Comment by Marc [ 2022-01-24 ]

Any news on this?

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