2

CiviCRM 4.6.11 to 4.7.1 Update Joomla 3.4.8

Error page during DB upgrade utility:

[Error: Add Getting Started dashlet]

Error Field
Error Value
Type
DB_Error
Code
-3
Message
DB Error: constraint violation
Mode  16
UserInfo
INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active) SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 0, IF (SUM(is_active) > 0, 1, 0) FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`famcafe_sandbox`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]

DebugInfo

INSERT INTO `civicrm_dashboard_contact` (dashboard_id, contact_id, column_no, is_active) SELECT (SELECT MAX(id) FROM `civicrm_dashboard`), contact_id, 0, IF (SUM(is_active) > 0, 1, 0) FROM `civicrm_dashboard_contact` WHERE 1 GROUP BY contact_id [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`famcafe_sandbox`.`civicrm_dashboard_contact`, CONSTRAINT `FK_civicrm_dashboard_contact_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]

PEAR_Exception: DB Error: constraint violation in unknown on line unknown
- DB_Error: DB Error: constraint violation in unknown on line unknown

Exception trace
#
Function  Location
0 CRM_Core_Error::exceptionHandler(Object(DB_Error))
unknown:unknown
1  call_user_func(Array, Object(DB_Error))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php:931
2 PEAR_Error->PEAR_Error('DB Error: constr…', -3, 16, Array, 'INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php:976
3 DB_Error->DB_Error(-3, 16, Array, 'INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php:564
4  PEAR->raiseError(null, -3, null, null, 'INSERT INTO `civ…', 'DB_Error', true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php:1905
5  DB_common->raiseError(-3, null, null, null, '1452 ** Cannot a…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php:895
6  DB_mysql->mysqlRaiseError()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php:328
7  DB_mysql->simpleQuery('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php:1216
8  DB_common->query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php:2435
9  DB_DataObject->_query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php:1627
10  DB_DataObject->query('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:334
11  CRM_Core_DAO->query('INSERT INTO `civ…', true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:1267
12  CRM_Core_DAO::executeQuery('INSERT INTO `civ…')
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Upgrade/Incremental/php/FourSeven.php:272
13  CRM_Upgrade_Incremental_php_FourSeven::addGettingStartedDashlet(Object(CRM_Queue_TaskContext), '4.7.alpha1')
unknown:unknown
14  call_user_func_array(Array, Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Task.php:88
15  CRM_Queue_Task->run(Object(CRM_Queue_TaskContext))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Runner.php:214
16  CRM_Queue_Runner->runNext(true)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Page/AJAX.php:52
17  CRM_Queue_Page_AJAX::{closure}()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/ErrorPolicy.php:106
18  CRM_Queue_ErrorPolicy->call(Object(Closure))
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Queue/Page/AJAX.php:54
19  CRM_Queue_Page_AJAX::runNext()
unknown:unknown
20  call_user_func(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:278
21  CRM_Core_Invoke::runItem(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:86
22  CRM_Core_Invoke::_invoke(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:54
23  CRM_Core_Invoke::invoke(Array)
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm.php:116
24  civicrm_invoke()
/home/famcafe/public_html/administrator/components/com_civicrm/civicrm.php:40
25  require_once('/home/famcafe/pu…')
/home/famcafe/public_html/libraries/cms/component/helper.php:392
26  JComponentHelper::executeComponent('/home/famcafe/pu…')
/home/famcafe/public_html/libraries/cms/component/helper.php:372
27  JComponentHelper::renderComponent('com_civicrm')
/home/famcafe/public_html/libraries/cms/application/administrator.php:98
28  JApplicationAdministrator->dispatch()
/home/famcafe/public_html/libraries/cms/application/administrator.php:152
29  JApplicationAdministrator->doExecute()
/home/famcafe/public_html/libraries/cms/application/cms.php:252
30  JApplicationCms->execute()
/home/famcafe/public_html/administrator/index.php:47
  • for whatever it is worth, I tried s smaller increment to 4.6.12 and the same error occurred. – Barbara Forbes-Lyons Feb 8 '16 at 15:33
1

I just encountered this and solved it.

I've opened a ticket CRM-18264 to address this issue, and I've submitted a pull request for both 4.6LTS and 4.7. They've been merged, so you just need to upgrade to CiviCRM 4.6.15+ or CiviCRM 4.7.5+.

  • Thank you, Jon! I'm trying it tonight after business hours have ended for the client and I'll let you know if it worked for me. Much appreciated. – Barbara Forbes-Lyons Mar 22 '16 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.