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 CiviEvent (Moderator: Yashodha Chaku) »
  • Can't add event - constraint violation error
Pages: [1]

Author Topic: Can't add event - constraint violation error  (Read 1682 times)

tmccartney

  • I post frequently
  • ***
  • Posts: 154
  • Karma: 9
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.28
Can't add event - constraint violation error
February 11, 2009, 03:44:35 pm
After running into major problems with our previous Civicrm install on Drupal, I decided to delete all the Civicrm files, all the tables and start from scratch.  I'm now in the process of re-creating my event and doing all that stuff.  I'm using PHP5 and the newest stable version of Civicrm.

However, I just tried to add a new event and got this:

Quote
Sorry. A non-recoverable error has occurred.


--------------------------------------------------------------------------------

DB Error: constraint violation

Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`tnfairho_civicrm/civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE), 1452


Error details:

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

       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_log (entity_table , entity_id , modified_id , modified_date ) VALUES ('civicrm_event' ,  1 ,  1 ,  20090211 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`tnfairho_civicrm/civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_log (entity_table , entity_id , modified_id , modified_date ) VALUES ('civicrm_event' ,  1 ,  1 ,  20090211 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`tnfairho_civicrm/civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_log (entity_table , entity_id , modified_id , modified_date ) VALUES ('civicrm_event' ,  1 ,  1 ,  20090211 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`tnfairho_civicrm/civicrm_log`, CONSTRAINT `FK_civicrm_log_modified_id` FOREIGN KEY (`modified_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]
)

[/quote]

Did I fail to delete a table somewhere?

Also, is it significant that my previous installation put all the tables in my Drupal database, and this one is putting them in a Civicrm database?  It may be just because of what I put in the blanks when I set it up.

Thanks,

Tracey

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Can't add event - constraint violation error
February 11, 2009, 04:22:59 pm
Try logging out of Drupal and then logging back in. Usually this error is a result of changing / rebuilding the CiviCRM DB while logged in (the session is pointing to an invalid contact record and / or is messed up).
Protect your investment in CiviCRM by  becoming a Member!

tmccartney

  • I post frequently
  • ***
  • Posts: 154
  • Karma: 9
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.28
Re: Can't add event - constraint violation error
February 11, 2009, 04:27:39 pm
Thanks.  That seems to have worked.


Tracey

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Can't add event - constraint violation error

This forum was archived on 2017-11-26.