Matt Winer
Matt Winer

Reputation: 535

MySQL - Duplicate Entry for Key

I'm getting an error when trying to add an entry to a table called collectionStatus

Duplicate entry '565_xxxxxx_gmail_com-toUpload' for key 'hotFolderPathAndParent'

I went back the table and deleted the row that contained the field '565_xxxxxx_gmail_com' and tried to re run the add and I still get the error.

I've never really worked with indexes so I'm not sure how to get around this. I'd like to clear out everything having to do with 565_xxxxxx_gmail_com so I can reprocess from my side.

  `collectionStatus` (
  `rowID` int(11) NOT NULL AUTO_INCREMENT,
  `fileCount2process` smallint(5) unsigned DEFAULT NULL,
  `hotFolderPath` varchar(260) NOT NULL,
  `parentFolderOf_hotFolderPath` char(8) NOT NULL,
  `collectionCreated` datetime DEFAULT NULL,
  `URL` char(30) NOT NULL DEFAULT '',
  `UUID` char(37) NOT NULL DEFAULT '',
  UNIQUE KEY `rowID_UNIQUE` (`rowID`),
  UNIQUE KEY `hotFolderPathAndParent` (`hotFolderPath`,`parentFolderOf_hotFolderPath`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COMMENT='Bucket for collections pending and created.'

*edit to add table details

Upvotes: 0

Views: 164

Answers (1)

Wouter
Wouter

Reputation: 1353

The column parentFolderOf_hotFolderPath can only have 8 characters. When you add the value 565_xxxxxx_gmail_com-toUpload it will add the value with the first 8 characters: 565_xxxx. You probably have the value 565_xxxx in your database?

Upvotes: 1

Related Questions