Hi Team,

I am facing issue when i am trying to upload a file.
i have used filefiled path madule.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'public://filefield_paths/4_A_confirmationq.wav' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp, origname) 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, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 4_A_confirmationq.wav [:db_insert_placeholder_2] => public://filefield_paths/4_A_confirmationq.wav [:db_insert_placeholder_3] => audio/x-wav [:db_insert_placeholder_4] => 268390 [:db_insert_placeholder_5] => 0 [:db_insert_placeholder_6] => 1480614460 [:db_insert_placeholder_7] => 4_A_confirmationq.wav ) in drupal_write_record() (line 7361 of /var/www/html/drupal_prod/includes/common.inc).

Please help me.

Thanks

Comments

jitendra_89 created an issue. See original summary.

cilefen’s picture

Project: Drupal core » File (Field) Paths
Version: 7.x-dev » 7.x-1.x-dev
Component: ajax system » Code
Category: Task » Bug report
Parent issue: #1953546: PDO Exception for Duplicate entries »
Related issues: -#2829116: Problem with file field paths, -#1953546: PDO Exception for Duplicate entries

I helped by moving this to that module's queue and by removing unrelated issues that may cause confusion. Good luck with the issue!

joelpittet’s picture

I'm running into this as well. One thing I noticed that is off topic but the temporary store is in the public:// filesystem.

Looking into this a bit further though.

joelpittet’s picture

Not sure how to reproduce but I think it was on a form error and re-submit because that uri is no longer in the db.

Changed it to $conf['filefield_paths_temp_location'] = 'temporary://filefield_paths'; regardless in my settings.php

cilefen’s picture

Priority: Critical » Major

No data is lost so probably this is major. Joel: should we just close this?

joelpittet’s picture

I'll let @jitendra_89 decide if it should be closed?

I ran into the issue too, it seemed related to a form error but I can't get it to trigger with similar steps.

deepak_123’s picture

Facing the same issue on running retroactive update from the field settings.

An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=863666&op=do StatusText: Service unavailable (with message) ResponseText: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'private://Capture_20.JPG' for key 'uri': UPDATE {file_managed} SET uid=:db_update_placeholder_0, filename=:db_update_placeholder_1, uri=:db_update_placeholder_2, filemime=:db_update_placeholder_3, filesize=:db_update_placeholder_4, status=:db_update_placeholder_5, timestamp=:db_update_placeholder_6, origname=:db_update_placeholder_7, type=:db_update_placeholder_8 WHERE (fid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 1578 [:db_update_placeholder_1] => Capture.JPG [:db_update_placeholder_2] => private://Capture_20.JPG [:db_update_placeholder_3] => image/jpeg [:db_update_placeholder_4] => 22085 [:db_update_placeholder_5] => 1 [:db_update_placeholder_6] => 1516270591 [:db_update_placeholder_7] => Capture.JPG [:db_update_placeholder_8] => image [:db_condition_placeholder_0] => 154781 ) in drupal_write_record() (line 7383 of /mnt/www/html/pega2dev/docroot/includes/common.inc).

I suspect this is linked to this issue - https://www.drupal.org/project/drupal/issues/1163740

rodrigoaguilera’s picture

Applying the patch #133 for D7 for this issue
https://www.drupal.org/project/drupal/issues/1556396
Really removed the error for me and files are uploaded with unique file names.