Answers.Body: <p>One of the first things that I do when investigating these types of errors is to bump the truncation of SQL queries from 80 to 800 - no idea where that file is off the top of my head, I usually find it by grepping "80".</p>
  
  <p>Then I run the command on the command line so that I get the full SQL error. Then it's much easier to fix.</p>
  
  <p>At some point I'll file a patch request with core to make this change available for everyone.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-10T06:44:32.453Z
Answers.Text: Thanx. What command are you referring to?
Answers.UserDisplayName: BruceW
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T12:29:39.237Z
Answers.Text: The bit in the log you copied and pasted which goes "UPDATE  civicrm_contact  SET contact_type = 'Individual'"... is an SQL command. These commands are run by CiviCRM to manipulate the data in the MySQL database. If you get the full command, by finding and updating the value I mentioned, then you will be able to read the native error. Hope that helps.
Answers.UserDisplayName: JohnFF
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-08T14:22:05.417Z
Answers.LastActivityDate: 2016-04-08T14:22:05.417Z
Answers.UserDisplayName: JohnFF
Body: <p>I am receiving this back trace when trying to merge records after running Individual Supervised dedupe rule. Please advise.</p>
  
  <pre><code>Apr 07 17:51:30  [info] $backTrace = #0 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
  #3 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php(976): PEAR_Error-&gt;PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #4 /home/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error-&gt;DB_Error(-1, 16, (Array:2), "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #5 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR-&gt;raiseError(NULL, -1, NULL, NULL, "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...", "DB_Error", TRUE)
  #6 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(895): DB_common-&gt;raiseError(-1, NULL, NULL, NULL, "1205 ** Lock wait timeout exceeded; try restarting transaction")
  #7 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql-&gt;mysqlRaiseError()
  #8 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql-&gt;simpleQuery("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #9 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2435): DB_common-&gt;query("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #10 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1338): DB_DataObject-&gt;_query("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #11 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(459): DB_DataObject-&gt;update()
  #12 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(213): CRM_Core_DAO-&gt;save()
  #13 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(312): CRM_Contact_BAO_Contact::add((Array:12))
  #14 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(1897): CRM_Contact_BAO_Contact::create((Array:12))
  #15 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Dedupe/Merger.php(1840): CRM_Contact_BAO_Contact::createProfileContact((Array:7), (Array:0), "152")
  #16 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Merge.php(318): CRM_Dedupe_Merger::moveAllBelongings("152", "9317", (Array:10))
  #17 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(423): CRM_Contact_Form_Merge-&gt;postProcess()
  #18 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Done.php(75): CRM_Core_Form-&gt;mainProcess()
  #19 /home/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Done-&gt;perform(Object(CRM_Contact_Form_Merge), "done")
  #20 /home/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller-&gt;handle(Object(CRM_Contact_Form_Merge), "done")
  #21 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page-&gt;handle("done")
  #22 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller-&gt;run()
  #23 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper-&gt;run("CRM_Contact_Form_Merge", "Merge Contact", NULL)
  #24 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
  #25 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
  #26 /home/public_html/administrator/components/com_civicrm/civicrm.php(116): CRM_Core_Invoke::invoke((Array:3))
  #27 /home/public_html/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
  #28 /home/public_html/libraries/cms/component/helper.php(392): require_once("/home/public_html/administrator/components/com_civicrm/civicrm.php")
  #29 /home/public_html/libraries/cms/component/helper.php(372): JComponentHelper::executeComponent("/home/public_html/administrator/components/com_civicrm/civicrm.php")
  #30 /home/public_html/libraries/cms/application/administrator.php(98): JComponentHelper::renderComponent("com_civicrm")
  #31 /home/public_html/libraries/cms/application/administrator.php(152): JApplicationAdministrator-&gt;dispatch()
  #32 /home/public_html/libraries/cms/application/cms.php(252): JApplicationAdministrator-&gt;doExecute()
  #33 /home/public_html/administrator/index.php(47): JApplicationCms-&gt;execute()
  #34 {main}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-08T19:20:22.577Z
Comments.Text: was this an issue with trying to merge contacts that were different sub-types? did those sub-types have different sets of custom fields on them? not sure how well merge would cope in that situation
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-10T06:43:36.170Z
Comments.Text: Different sub-types? Do you mean like' Home', 'Work', 'Main', etc?. All records are using the same data fields in all categories. The rule was using the default for first name, last name and email address.
Comments.UserDisplayName: BruceW
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-10T06:54:53.083Z
Comments.Text: But what difference does it make? If there was different data in the same fields or different fields and the merge was to add in the same or different fields it was coming from, custom or not, all those fields would be already listed in the fixed drop-down menus.
Comments.UserDisplayName: BruceW
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-10T19:40:55.767Z
Comments.Text: I meant Contact Sub-Types. Eg core gives you Individual. but you can make sub-types eg Student or Teacher. And for each sub-type you can make Custom Fields, eg Student might have Class, while Teacher might have Qualifications. And the only reason I raised it was that it might be an edge case that Merge doesn't like.
Comments.UserDisplayName: petednz - fuzion
Tags: <4.7.1><duplicate-contacts>
Title: Dedupe failing on merge
ThreadText: # Dedupe failing on merge
  
  (Asked by: username_0 on 2016-04-08)
  
  I am receiving this back trace when trying to merge records after running Individual Supervised dedupe rule. Please advise.
  
  ```
  Apr 07 17:51:30  [info] $backTrace = #0 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Error.php(235): CRM_Core_Error::backtrace("backTrace", TRUE)
  #1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
  #2 /home/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
  #3 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: unknown error", -1, 16, (Array:2), "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #4 /home/public_html/administrator/components/com_civicrm/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-1, 16, (Array:2), "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #5 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -1, NULL, NULL, "UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...", "DB_Error", TRUE)
  #6 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-1, NULL, NULL, NULL, "1205 ** Lock wait timeout exceeded; try restarting transaction")
  #7 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError()
  #8 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #9 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(2435): DB_common->query("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #10 /home/public_html/administrator/components/com_civicrm/civicrm/packages/DB/DataObject.php(1338): DB_DataObject->_query("UPDATE  civicrm_contact  SET contact_type = 'Individual' , contact_sub_type =...")
  #11 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(459): DB_DataObject->update()
  #12 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(213): CRM_Core_DAO->save()
  #13 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(312): CRM_Contact_BAO_Contact::add((Array:12))
  #14 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Contact.php(1897): CRM_Contact_BAO_Contact::create((Array:12))
  #15 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Dedupe/Merger.php(1840): CRM_Contact_BAO_Contact::createProfileContact((Array:7), (Array:0), "152")
  #16 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/Form/Merge.php(318): CRM_Dedupe_Merger::moveAllBelongings("152", "9317", (Array:10))
  #17 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php(423): CRM_Contact_Form_Merge->postProcess()
  #18 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Done.php(75): CRM_Core_Form->mainProcess()
  #19 /home/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Done->perform(Object(CRM_Contact_Form_Merge), "done")
  #20 /home/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Contact_Form_Merge), "done")
  #21 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php(351): HTML_QuickForm_Page->handle("done")
  #22 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Wrapper.php(113): CRM_Core_Controller->run()
  #23 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(286): CRM_Utils_Wrapper->run("CRM_Contact_Form_Merge", "Merge Contact", NULL)
  #24 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(86): CRM_Core_Invoke::runItem((Array:13))
  #25 /home/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php(54): CRM_Core_Invoke::_invoke((Array:3))
  #26 /home/public_html/administrator/components/com_civicrm/civicrm.php(116): CRM_Core_Invoke::invoke((Array:3))
  #27 /home/public_html/administrator/components/com_civicrm/civicrm.php(40): civicrm_invoke()
  #28 /home/public_html/libraries/cms/component/helper.php(392): require_once("/home/public_html/administrator/components/com_civicrm/civicrm.php")
  #29 /home/public_html/libraries/cms/component/helper.php(372): JComponentHelper::executeComponent("/home/public_html/administrator/components/com_civicrm/civicrm.php")
  #30 /home/public_html/libraries/cms/application/administrator.php(98): JComponentHelper::renderComponent("com_civicrm")
  #31 /home/public_html/libraries/cms/application/administrator.php(152): JApplicationAdministrator->dispatch()
  #32 /home/public_html/libraries/cms/application/cms.php(252): JApplicationAdministrator->doExecute()
  #33 /home/public_html/administrator/index.php(47): JApplicationCms->execute()
  #34 {main}
  
  ```
  
  **Tags:** 4.7.1, duplicate-contacts
  
  > **Comments:**
  > **username_1**: was this an issue with trying to merge contacts that were different sub-types? did those sub-types have different sets of custom fields on them? not sure how well merge would cope in that situation  
  > **username_0**: Different sub-types? Do you mean like' Home', 'Work', 'Main', etc?. All records are using the same data fields in all categories. The rule was using the default for first name, last name and email address.  
  > **username_0**: But what difference does it make? If there was different data in the same fields or different fields and the merge was to add in the same or different fields it was coming from, custom or not, all those fields would be already listed in the fixed drop-down menus.  
  > **username_1**: I meant Contact Sub-Types. Eg core gives you Individual. but you can make sub-types eg Student or Teacher. And for each sub-type you can make Custom Fields, eg Student might have Class, while Teacher might have Qualifications. And the only reason I raised it was that it might be an edge case that Merge doesn't like.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-04-08. Score: 1
  
  One of the first things that I do when investigating these types of errors is to bump the truncation of SQL queries from 80 to 800 - no idea where that file is off the top of my head, I usually find it by grepping "80".
  
  Then I run the command on the command line so that I get the full SQL error. Then it's much easier to fix.
  
  At some point I'll file a patch request with core to make this change available for everyone.
  
  > **Comments:**
  > **username_0**: Thanx. What command are you referring to?  
  > **username_2**: The bit in the log you copied and pasted which goes "UPDATE  civicrm_contact  SET contact_type = 'Individual'"... is an SQL command. These commands are run by CiviCRM to manipulate the data in the MySQL database. If you get the full command, by finding and updating the value I mentioned, then you will be able to read the native error. Hope that helps.  
  
  ---
  
  