I have been spinning my wheels all day trying to upgrade an old CiviCRM installation. It was running 4.3.4, and I need to get it up to at least the latest 4.6.x. This error has been dogging me the whole way:
[Error: Finish Upgrade DB to 4.4.alpha1] PDOException: "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'civicrm_handler_field_custom_file-class' for key 'PRIMARY'"
I've gone so far as to approach the upgrade in steps; upgrade to the latest 4.3, then 4.4, etc. after starting out trying to do the whole thing (to 4.6.15) in one fell swoop. I did manage to get it upgraded in that way to 4.3.11, but trying to upgrade to 4.4.21 causes the error.
Googling the error turned up this thread from the forum: https://forum.civicrm.org/index.php?topic=35976.0 so I tried the last suggestion of disabling/enabling CiviCRM beforehand but there was no improvement. I also tried deleting rows in the registry and registry_files tables that reference civicrm_handler_field_custom_file but that didn't help either.
Suggestions from anyone?
Here's my whole stack trace:
[Error: Finish Upgrade DB to 4.4.alpha1] PDOException: "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'civicrm_handler_field_custom_file-class' for key 'PRIMARY'"
#0 /home/mydomain/domains/mydomain.net/public_html/includes/database/database.inc(2139): PDOStatement->execute((Array:5))
#1 /home/mydomain/domains/mydomain.net/public_html/includes/database/database.inc(664): DatabaseStatementBase->execute((Array:5), (Array:4))
#2 /home/mydomain/domains/mydomain.net/public_html/includes/database/mysql/query.inc(36): DatabaseConnection->query("INSERT INTO {registry} (name, type, filename, module, weight) VALUES (:db_ins...", (Array:5), (Array:2))
#3 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(179): InsertQuery_mysql->execute()
#4 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(144): _registry_parse_file("sites/all/modules/civicrm/drupal/modules/views/civicrm/civicrm_handler_field_...", "<?php\n/*\n +----------------------------------------------------------------...", "civicrm", "100")
#5 /home/mydomain/domains/mydomain.net/public_html/includes/registry.inc(82): _registry_parse_files((Array:180))
#6 /home/mydomain/domains/mydomain.net/public_html/includes/bootstrap.inc(3076): _registry_update()
#7 /home/mydomain/domains/mydomain.net/public_html/includes/bootstrap.inc(3062): registry_update()
#8 /home/mydomain/domains/mydomain.net/public_html/includes/common.inc(7238): registry_rebuild()
#9 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Utils/System/Drupal.php(991): drupal_flush_all_caches()
#10 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Upgrade/Form.php(607): CRM_Utils_System_Drupal->flush()
#11 [internal function](): CRM_Upgrade_Form::doIncrementalUpgradeFinish(Object(CRM_Queue_TaskContext), "4.4.alpha1", "4.3.11", "4.4.21", "/tmp/civicrm-post-upgrade7AnGtE")
#12 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Task.php(79): call_user_func_array((Array:2), (Array:5))
#13 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Runner.php(186): CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
#14 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(44): CRM_Queue_Runner->runNext(TRUE)
#15 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/ErrorPolicy.php(80): {closure}()
#16 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Queue/Page/AJAX.php(47): CRM_Queue_ErrorPolicy->call(Object(Closure))
#17 [internal function](): CRM_Queue_Page_AJAX::runNext((Array:5))
#18 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(293): call_user_func((Array:2), (Array:5))
#19 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(76): CRM_Core_Invoke::runItem((Array:13))
#20 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/CRM/Core/Invoke.php(52): CRM_Core_Invoke::_invoke((Array:5))
#21 /home/mydomain/domains/mydomain.net/public_html/sites/all/modules/civicrm/drupal/civicrm.module(484): CRM_Core_Invoke::invoke((Array:5))
#22 [internal function](): civicrm_invoke("upgrade", "queue", "ajax", "runNext")
#23 /home/mydomain/domains/mydomain.net/public_html/includes/menu.inc(517): call_user_func_array("civicrm_invoke", (Array:4))
#24 /home/mydomain/domains/mydomain.net/public_html/index.php(21): menu_execute_active_handler()
#25 {main}