Upgrade to D7 fails: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry

Created on 14 May 2012, almost 13 years ago
Updated 26 June 2023, almost 2 years ago

Problem/Motivation

I just finished a core upgrade from drupal 6 to drupal 7. According to the documentation, I tried to use this module in order to upgrade my images as well. After I started the process, I got this error:
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=3384&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://images/eett.jpg' for key 2: INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => eett.jpg [:db_insert_placeholder_2] => public://images/eett.jpg [:db_insert_placeholder_3] => image/jpeg [:db_insert_placeholder_4] => 17768 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1261754184 ) in image_legacy_field_convert_object_pre_load() (line 229 of /home/radiofon/public_html/drupal-7.12/sites/all/modules/image/image_legacy.field_convert.inc).

Suspected cause

I am trying to determine the cause of the problem. In the beginning I thought it has to do with file duplicates
#1176186: D6 -> D7 upgrade: Duplicate files cause Integrity constraint violation: 1062 Duplicate entry 'xx' for key 'PRIMARY'
but in fact, the files mentioned in the error, appears only once in the {file} table.

I managed to overcome the problem for this file, by simply renaming the file in the hard disk and the database. A few thousand were processed with no problem, but when another file had the same issue, the upgrade process halts again with the same error.

For some reason, a duplicate is reported when the file is about to be entered in the {file_managed} table. But since this file only occurs once in the original table, I cannot figure out the exact cause of the problem

🐛 Bug report
Status

Closed: outdated

Version

1.0

Component

image.module

Created by

🇬🇷Greece radiobuzzer

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024