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 (Moderator: Dave Greenberg) »
  • Database error
Pages: [1]

Author Topic: Database error  (Read 714 times)

dmcgrew

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.0.4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Database error
July 26, 2011, 10:04:14 am
I keep getting this database error on my site. Any idea what is causing this? I had it on a previous installation, couldn't fix it, so I reinstalled and I'm getting the same errors. ARGH.  :'(


Database Error Code: Cannot add or update a child row: a foreign key constraint fails (`3riversCiviCRM`.`civicrm_event`, CONSTRAINT `FK_civicrm_event_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL), 1452

Additional Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )
     
       
Code: [Select]
=> -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_event (title , summary , description , event_type_id , participant_listing_id , is_public , start_date , end_date , max_participants , event_full_text , is_map , is_active , default_role_id , has_waitlist , is_template , created_id , created_date ) VALUES ('13th Annual 3 Rivers Wet Weather Sewer Conference' ,  NULL ,  NULL ,  1 ,  NULL ,  0 ,  20111004000000 ,  20111005000000 ,  NULL , 'This event is currently full.' ,  0 ,  1 ,  1 ,  0 ,  0 ,  102 ,  20110726130000 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`3riversCiviCRM`.`civicrm_event`, CONSTRAINT `FK_civicrm_event_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL)]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_event (title , summary , description , event_type_id , participant_listing_id , is_public , start_date , end_date , max_participants , event_full_text , is_map , is_active , default_role_id , has_waitlist , is_template , created_id , created_date ) VALUES ('13th Annual 3 Rivers Wet Weather Sewer Conference' ,  NULL ,  NULL ,  1 ,  NULL ,  0 ,  20111004000000 ,  20111005000000 ,  NULL , 'This event is currently full.' ,  0 ,  1 ,  1 ,  0 ,  0 ,  102 ,  20110726130000 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`3riversCiviCRM`.`civicrm_event`, CONSTRAINT `FK_civicrm_event_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL)]
    [to_string] => [db_error: message="DB Error: constraint violation" code=-3 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_event (title , summary , description , event_type_id , participant_listing_id , is_public , start_date , end_date , max_participants , event_full_text , is_map , is_active , default_role_id , has_waitlist , is_template , created_id , created_date ) VALUES ('13th Annual 3 Rivers Wet Weather Sewer Conference' ,  NULL ,  NULL ,  1 ,  NULL ,  0 ,  20111004000000 ,  20111005000000 ,  NULL , 'This event is currently full.' ,  0 ,  1 ,  1 ,  0 ,  0 ,  102 ,  20110726130000 )  [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`3riversCiviCRM`.`civicrm_event`, CONSTRAINT `FK_civicrm_event_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL)]"]
)

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database error
July 26, 2011, 10:23:30 am
It's referencing a non-existing contact_id as creator. Log out and log back in - should fix it since that will re-create the civicrm contact record for your logged in user. Generally this happens to me if I reload sample DB / reinstall civi while logged in and don't log out / log back in.
Protect your investment in CiviCRM by  becoming a Member!

dmcgrew

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.0.4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Re: Database error
July 26, 2011, 10:29:35 am
Quote from: Dave Greenberg on July 26, 2011, 10:23:30 am
It's referencing a non-existing contact_id as creator. Log out and log back in - should fix it since that will re-create the civicrm contact record for your logged in user. Generally this happens to me if I reload sample DB / reinstall civi while logged in and don't log out / log back in.

Yesssss that fixed it. Thanks!!

dmcgrew

  • I’m new here
  • *
  • Posts: 16
  • Karma: 0
  • CiviCRM version: 4.0.4
  • CMS version: Drupal 7
  • MySQL version: 5
  • PHP version: 5.3
Re: Database error
July 26, 2011, 11:05:34 am
Agghhh.. so here's another error..

Notice: Undefined index: location_option in CRM_Event_Form_ManageEvent_Location->postProcess() (line 251 of /Applications/MAMP/htdocs/3rivers/sites/all/modules/civicrm/CRM/Event/Form/ManageEvent/Location.php).

I seem to be getting a lot of these Undefined Index errors. Anyone know what could be causing them?

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Database error
July 26, 2011, 02:23:16 pm
Folks are working on catching and fixing those notices over time. They are not errors, only notices so generally will not affect functionality. The reason they are popping up is because D7 default PHP error reporting level is higher than D6 - so these went un-noticed in prior releases (and for folks using 3.4.x on D6).

I've recreated that one and a few others along the way and posted an issue here:
http://issues.civicrm.org/jira/browse/CRM-8564

If you find a few others you can add them as comments in the next few days. If you are a coder, the fix for most of these is to use the CRM_Utils_Array::value() function when testing for value of an item in an array where the item may or may not exist.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Database error

This forum was archived on 2017-11-26.