Sooo, you are updating Drupal and got some duplicate entry? Use this!
Keep your errors close, you'll need them. You can always see them in the logs if you are at Drupal 6 www.test.com/?q=admin/reports/dblog
First of all, these querys should return nothing:
SELECT format, module, delta, COUNT(*) FROM filters GROUP BY format, module, delta HAVING COUNT(*) > 1;
SELECT language, lid, plural, COUNT(*) FROM locales_target GROUP BY language, lid, plural HAVING COUNT(*) > 1;
SELECT nid, uid, hostname, COUNT(*) FROM poll_votes GROUP BY nid, uid, hostname HAVING COUNT(*) > 1;
SELECT uid, fid, COUNT(*) FROM profile_values GROUP BY uid, fid HAVING COUNT(*) > 1
If so, use this template to remove duplicates :
ALTER IGNORE TABLE _TABLE_NAME_ ADD UNIQUE INDEX(_WHAT YOU SEE between "GROUP BY" and "HAVING" here!_)
Let say you had when updating :
Update #6043
Failed: ALTER TABLE {filters} ADD UNIQUE KEY fmd (format, module, delta)
Then you should use this to remove duplicate :
ALTER IGNORE TABLE filters ADD UNIQUE INDEX(format, module, delta)
And then do the query again to update manually (and remove the brackets):
ALTER TABLE filters ADD UNIQUE KEY fmd (format, module, delta)
Now, why these duplicate happens? No ideas. Happy upgrading!
References