Bug #2618 Duplicate entry error for mediumtext index
Submitted: 2 Feb 2004 16:30 Modified: 3 Feb 2004 8:15
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:4.0.17 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[2 Feb 2004 16:30] [ name withheld ]
Description:
Following SQL commands:

  CREATE TABLE `test` (
    `text` mediumtext NOT NULL,
    KEY `text` (`text`(5))
  ) TYPE=MyISAM;

  INSERT INTO `test` VALUES ('xxxx x');
  INSERT INTO `test` VALUES ('xxxx x');

results in:

  Duplicate entry 'xxxx ' for key 1

The problem is with the space character at the end of indexed part of the field.
It seems there is no such problem in 4.0.16

   Honza Malik

How to repeat:
CREATE TABLE `test` (
  `text` mediumtext NOT NULL,
  KEY `text` (`text`(5))
) TYPE=MyISAM;

INSERT INTO `test` VALUES ('xxxx x');
INSERT INTO `test` VALUES ('xxxx x');
[3 Feb 2004 8:15] Alexander Keremidarski
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Additional info:

I was unable to repeat it. Are you sure you don't have Primary or Unique key on `text` ?

mysql>   CREATE TABLE `test` (
    ->     `text` mediumtext NOT NULL,
    ->     KEY `text` (`text`(5))
    ->   ) TYPE=MyISAM;
Query OK, 0 rows affected (0.03 sec)
 
mysql>
mysql>   INSERT INTO `test` VALUES ('xxxx x');
Query OK, 1 row affected (0.04 sec)
 
mysql>   INSERT INTO `test` VALUES ('xxxx x');
Query OK, 1 row affected (0.01 sec)