Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Following error after executing update.php after updating code:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'sites/all/modules/ctools/tests/ctools_export_test/ctools_export_' for key 'PRIMARY': INSERT INTO {system} (filename, name, type, owner, info) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => sites/all/modules/ctools/tests/ctools_export_test/ctools_export_test.module [:db_insert_placeholder_1] => ctools_export_test [:db_insert_placeholder_2] => module [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => a:12:{s:4:"name";s:18:"CTools export test";s:11:"description";s:25:"CTools export test module";s:4:"core";s:3:"7.x";s:7:"package";s:16:"Chaos tool suite";s:12:"dependencies";a:1:{i:0;s:6:"ctools";}s:6:"hidden";b:1;s:5:"files";a:1:{i:0;s:18:"ctools_export.test";}s:7:"version";s:7:"7.x-1.1";s:7:"project";s:6:"ctools";s:9:"datestamp";s:10:"1344463011";s:3:"php";s:5:"5.2.4";s:9:"bootstrap";i:0;} ) in system_update_files_database() (line 2294 of /PATH/TO/WEBSITE/www/modules/system/system.module).
Comments
Comment #1
robmalon CreditAttribution: robmalon commentedSame thing:
Running update.php again seems to pass amicably, but no further updates were needed.
I went into a custom view of mine and tinkered a bit with adding/removing fields since I know ctools is used there and received no errors. I'm guessing it didn't have any debilitating effects, but still odd...
I'm using a fairly new install which is not yet a production site and am on 7.15.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedHandling the system table is core, I'm not sure how this can be a bug of ctools.
Comment #3
lyricnz CreditAttribution: lyricnz commentedYes, it sounds like a core bug, triggered by something ctools happened to do.
The method that is failing in system.module is system_update_files_database() - where it's attempting to add new files (ctools_export_test.module in this case) to the list of files. I wonder how it got added to the table before this point?
Comment #4
lyricnz CreditAttribution: lyricnz commentedIs the truncation of the PK value in the messages above significant? Could we have something that is non-unique for some substring of the "filename" value? (I don't think so)
It looks like Drupal updated {system} before update.php did, and the latter failed. Unable to reproduce with a DB backup, will try again with older version.
Comment #5
Leeteq CreditAttribution: Leeteq commented@lyricnz: are you on 7.15 too?
Comment #6
lyricnz CreditAttribution: lyricnz commentedYes. Have been unable to reproduce the problem so far.
Comment #7
mgiffordThis is possibly related to:
#1135848: Feedback on using export ui for the first time
#539534: Duplicate entry in ctools_css_cache
Comment #7.0
mgiffordUpdate with comment about how error occurred
Comment #8
DamienMcKennaIt has been two years, core has gone from 7.15 to 7.34 and several people have been unable to reproduce the problem. If the problem still persists please reopen this issue, otherwise I suspect it was fixed along the way either in core or CTools.