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) »
  • Odd random problem: Cannot delete contact(s)
Pages: [1]

Author Topic: Odd random problem: Cannot delete contact(s)  (Read 1349 times)

bob schmitt

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • Expeditionary Information Systems
Odd random problem: Cannot delete contact(s)
June 12, 2007, 09:44:45 pm
Drupal 4.7, CiviCRM 1.7

I'm playing with a registration process and doing a lot of tests, so I need to periodically delete a bunch of test contacts. Sometimes I can, no problem. Sometimes I can't, with this message:

Code: [Select]

Database Error Code: Cannot delete or update a parent row: a foreign key constraint fails, 1217

Return to CiviCRM menu.

Error Details:

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

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 771 )  [nativecode=1217 ** Cannot delete or update a parent row: a foreign key constraint fails]
    [type] => db_error
    [user_info] => DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 771 )  [nativecode=1217 ** Cannot delete or update a parent row: a foreign key constraint fails]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="DELETE FROM civicrm_contact  WHERE (  civicrm_contact.id = 771 )  [nativecode=1217 ** Cannot delete or update a parent row: a foreign key constraint fails]"]
)


Here's where it gets weird: Sometimes I can delete the contacts by only selecting a couple of the contacts, then deleting them. Other times, I can delete the contacts only by viewing the individual contact record, and deleting from there.

Othertimes, I cannot delete a contact at all.

Any clues about how to resolve this would be helpful. We normally don't delete much, but I've been running tests all day and need to recover the accounts so I can reuse the test email accounts.

bob
[/code]
« Last Edit: June 12, 2007, 09:46:33 pm by bob schmitt »

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Odd random problem: Cannot delete contact(s)
June 13, 2007, 10:17:12 am
Bob - We've seen several causes of this at different times - most of which I think have been corrected (some in the upcoming 1.8 release :-) ).

Some things to check:
* Contact(s) assigned to CiviMember memberships, and then CiviMember is disabled - so delete doesn't cleanup related membership records. If this scenario is a possibility, re-enabling CiviMember should fix it.
* Trying to delete a contact associated w/ a user who has been updating other contacts (and hence they are referenced in civicrm_log).
* Others along this line...

If you have easy access to mysql command line or phpMyAdmin - run some selects against the contact_id  (771) on tables w/ FK's to civicrm_contact.id. Let us know what you find (or if you need more guidance to debug).

dave
Protect your investment in CiviCRM by  becoming a Member!

bob schmitt

  • I’m new here
  • *
  • Posts: 22
  • Karma: 1
    • Expeditionary Information Systems
Re: Odd random problem: Cannot delete contact(s)
June 13, 2007, 11:06:59 am
Hey Dave-

I did two things:

a) enabled CiviMember and

b) upgraded the code to the June 8 version of 1.7.

So far, no problems...(my test contacts deleted just fine) but I haven't poked this as much today. I'll debug further if this happens again.

Hopefully this is resolved. Thanks for the clues!


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Odd random problem: Cannot delete contact(s)

This forum was archived on 2017-11-26.