CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • can not delete contacts
Pages: [1]

Author Topic: can not delete contacts  (Read 1409 times)

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
can not delete contacts
June 06, 2008, 07:46:06 am
hello,

when I try to delete a single contact, I get this error message:


unrecovable error:


    database-errorcode: Cannot delete or update a parent row: a foreign key constraint fails (`civicrm2/civicrm_individual`, CONSTRAINT `FK_civicrm_individual_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`)), 1451

    Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -1
    [message] => DB Error: unknown error
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 43967 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`civicrm2/civicrm_individual`, CONSTRAINT `FK_civicrm_individual_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]
    [type] => DB_Error
    [user_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 43967 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`civicrm2/civicrm_individual`, CONSTRAINT `FK_civicrm_individual_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]
    [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 43967 )  [nativecode=1451 ** Cannot delete or update a parent row: a foreign key constraint fails (`civicrm2/civicrm_individual`, CONSTRAINT `FK_civicrm_individual_contact_id` FOREIGN KEY (`contact_id`) REFERENCES `civicrm_contact` (`id`))]"]
)

backTrace

/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 148
, handle,
/var/www/civicrm2/sites/all/modules/civicrm/packages/PEAR.php, call_user_func, 901
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB.php, PEAR_Error, 888
/var/www/civicrm2/sites/all/modules/civicrm/packages/PEAR.php, DB_Error, 563
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/common.php, raiseError, 1849
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/mysql.php, raiseError, 894
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/mysql.php, mysqlRaiseError, 324
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/common.php, simpleQuery, 1162
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/DataObject.php, query, 2343
/var/www/civicrm2/sites/all/modules/civicrm/packages/DB/DataObject.php, _query, 1394
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Contact/BAO/Contact.php, delete, 999
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Contact/Form/Task/Delete.php, deleteContact, 114
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/QuickForm/Action/Done.php, postProcess, 79
/var/www/civicrm2/sites/all/modules/civicrm/packages/HTML/QuickForm/Controller.php, perform, 195
/var/www/civicrm2/sites/all/modules/civicrm/packages/HTML/QuickForm/Page.php, handle, 95
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/Controller.php, handle, 223
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 540
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/Invoke.php, search, 435
/var/www/civicrm2/sites/all/modules/civicrm/CRM/Core/Invoke.php, contact, 98
/var/www/civicrm2/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 329
, civicrm_invoke,
/var/www/civicrm2/includes/menu.inc, call_user_func_array, 418
/var/www/civicrm2/index.php, menu_execute_active_handler, 15

Thank you for any hint.

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: can not delete contacts
June 07, 2008, 11:37:35 am
What version of CiviCRM are you running? If this is a 2.0 site that was upgraded from 1.9 or earlier - it looks like some of the required schema changes didn't happen. Check the "Ensuring Schema Integrity"section in the upgrade instructions.
 
If this doesn't help - you'll need to provide more info about the installation.
Protect your investment in CiviCRM by  becoming a Member!

Matt2000

  • I post frequently
  • ***
  • Posts: 288
  • Karma: 27
    • http://www.ninjitsuweb.com
Re: can not delete contacts
June 09, 2008, 09:55:15 pm
Also, if using ACLs, try emptying your _acl_cache table. This solved this problem for me after one upgrade.
Drupal/CiviCRM micro-blogging http://twitter.com/matt2000

Ninjitsu Web Development http://www.NinjitsuWeb.com/

kaless

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
Re: can not delete contacts
June 16, 2008, 04:10:15 am
Hi,

thanks for the tip. Emptying my acl_cach-table didn't solve my problem.

I'm running civicrm 2.0.3. It was upgraded from 1.9. The update-script from 1.9 to 2.0.3 doesn't run. because the schema is identified as a 2.0 schema. What can I do?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: can not delete contacts
June 16, 2008, 12:01:21 pm
Did you successfully run the section of the upgrade instructions which covers "Ensuring Schema Integrity" ...
http://wiki.civicrm.org/confluence/display/CRMDOC/Upgrade+Drupal+Sites+to+2.0#UpgradeDrupalSitesto2.0-4.Rebuildyour1.9DatabasetoEnsureSchemaIntegrity

If not, your best bet is to run through those steps using a copy of your 1.9 database. Then download 2.0.4 (which has some upgrade-related fixes) and run the upgrade script again.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • can not delete contacts

This forum was archived on 2017-11-26.