Bug #20710 ERROR 1062 (23000): Duplicate entry '%s' for key 1
Submitted: 27 Jun 2006 0:21 Modified: 4 May 2007 18:55
Reporter: Morgan Tocker Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Errors Severity:S3 (Non-critical)
Version:4.1.x OS:Any (ALL)
Assigned to: Gleb Shchepa CPU Architecture:Any

[27 Jun 2006 0:21] Morgan Tocker
Description:
The error message does not indicate the rows that are duplicated, but the value '%s'.  This seems to be related to the length of the value being over 230 characters.

Verified in 4.1.20.
Bug does not exist in 5.0.20.

How to repeat:
mysql> CREATE TABLE tbl (a varchar(255) collate utf8_unicode_ci NOT NULL default '') ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Query OK, 0 rows affected (0.11 sec)

mysql> INSERT INTO tbl VALUES (REPEAT('x', 240)), (REPEAT('x', 240));
Query OK, 2 rows affected (0.11 sec)
Records: 2  Duplicates: 0  Warnings: 0

mysql> ALTER TABLE tbl ADD UNIQUE (a);
ERROR 1062 (23000): Duplicate entry '%s' for key 1
[27 Jun 2006 7:24] MySQL Verification Team
Verified on 4.1BK on Linux

mysql> ALTER TABLE tbl ADD UNIQUE (a);
ERROR 1062 (23000): Duplicate entry '%s' for key 1
mysql> select version();
+--------------+
| version()    |
+--------------+
| 4.1.21-debug |
+--------------+
1 row in set (0.00 sec)

------------

mysql> ALTER TABLE tbl ADD UNIQUE (a);
ERROR 1062 (23000): Duplicate entry 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' for key 1
mysql> select version();
+--------------+
| version()    |
+--------------+
| 5.0.23-debug |
+--------------+

------------

mysql> ALTER TABLE tbl ADD UNIQUE (a);
ERROR 1062 (23000): Duplicate entry 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' for key 'a'
mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 5.1.12-beta-debug |
+-------------------+
1 row in set (0.00 sec)
[28 Apr 2007 18:34] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25677

ChangeSet@1.2637, 2007-04-28 23:45:32+05:00, gshchepa@gshchepa.loc +3 -0
  Fixed bug #20710.
  This bug occurs when error message length exceeds allowed limit: my_error()
  function output "%s" sequences instead of long string arguments.
  Formats like %-.64s are very common in errmsg.txt files, however my_error()
  function simply ignores precision of those formats.
[28 Apr 2007 19:39] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25680

ChangeSet@1.2637, 2007-04-29 00:50:33+05:00, gshchepa@gshchepa.loc +3 -0
  Fixed bug #20710.
  This bug occurs when error message length exceeds allowed limit: my_error()
  function outputs "%s" sequences instead of long string arguments.
  
  Formats like %-.64s are very common in errmsg.txt files, however my_error()
  function simply ignores precision of those formats.
[28 Apr 2007 23:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25687

ChangeSet@1.2638, 2007-04-29 04:40:28+05:00, gshchepa@gshchepa.loc +1 -0
  Fixed bug #20710.
  This bug occurs when error message length exceeds allowed limit: my_error()
  function outputs "%s" sequences instead of long string arguments.
  
  Formats like %-.64s are very common in errmsg.txt files, however my_error()
  function simply ignores precision of those formats.
[28 Apr 2007 23:55] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/25688

ChangeSet@1.2638, 2007-04-29 05:06:14+05:00, gshchepa@gshchepa.loc +1 -0
  Adjusted results after the fix for bug #20710.
[30 Apr 2007 12:56] Bugs System
Pushed into 4.1.23
[30 Apr 2007 12:58] Bugs System
Pushed into 5.0.42
[30 Apr 2007 12:59] Bugs System
Pushed into 5.1.18-beta
[4 May 2007 18:55] Paul DuBois
Noted in 4.1.23 changelog.

Some long error messages were printed incorrectly.

The fix does not apply to 5.0/5.1.