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) »
  • constraint violation on sync users to contacts
Pages: [1]

Author Topic: constraint violation on sync users to contacts  (Read 3538 times)

abe

  • Guest
constraint violation on sync users to contacts
January 09, 2008, 10:20:01 pm
I am consistently getting constraint violation errors when I sync users, or add users.

I am running Drupal 5.5, civicrm 1.9

I loaded civicrm_41.mysql and civicrm_data.mysql.  I also tried civicrm_generated.mysql and also got similar errors when adding users.

I found constraint errors in another forum topic, but it shows a different table that causes the constraint error.

thanks for any help. 

Thanks,  Abe


==================
sync user error
==================
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 , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1 , 'civicrm_contact,1' ,  104 ,  20080110010720 )  [nativecode=1216 ** Cannot add or update a child row: a foreign key constraint fails]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1 , 'civicrm_contact,1' ,  104 ,  20080110010720 )  [nativecode=1216 ** Cannot add or update a child 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="INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  1 , 'civicrm_contact,1' ,  104 ,  20080110010720 )  [nativecode=1216 ** Cannot add or update a child row: a foreign key constraint fails]"]
)

==============
add user error
==============
     Sorry. A non-recoverable error has occurred.

    Database Error Code: Cannot add or update a child row: a foreign key constraint fails, 1216

    Return to home page.

Error Details:

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

    [code] => -3
    [message] => DB Error: constraint violation
    [mode] => 16
    [debug_info] => INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  3 , 'civicrm_contact,3' ,  104 ,  20080110011319 )  [nativecode=1216 ** Cannot add or update a child row: a foreign key constraint fails]
    [type] => DB_Error
    [user_info] => INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  3 , 'civicrm_contact,3' ,  104 ,  20080110011319 )  [nativecode=1216 ** Cannot add or update a child 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="INSERT INTO civicrm_log (entity_table , entity_id , data , modified_id , modified_date ) VALUES ('civicrm_contact' ,  3 , 'civicrm_contact,3' ,  104 ,  20080110011319 )  [nativecode=1216 ** Cannot add or update a child row: a foreign key constraint fails]"]
)
[/code]

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: constraint violation on sync users to contacts
January 09, 2008, 11:24:28 pm
Can you check:

http://forum.civicrm.org/index.php/topic,922.0.html

kurund
Found this reply helpful? Support CiviCRM

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: constraint violation on sync users to contacts
January 10, 2008, 02:27:17 pm
Make sure you log out of Drupal and also try truncating the Drupal sessions table. It looks like you've got an invalid contact ID associated with the logged in user - which often happens when you do DB operations while logged in.
Protect your investment in CiviCRM by  becoming a Member!

abe

  • Guest
Re: constraint violation on sync users to contacts
January 10, 2008, 06:48:37 pm
Thanks. 

I did:
1. I went thru the suggested forum logs.
2. truncated all the cache tables (I did not truncate the sessions table),
3. logged out of Drupal,
4. login back into Drupal, and
5. finally synched contacts. 

It worked and now I can add/change/delete contacts!   

:) :) :)

Abe

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • constraint violation on sync users to contacts

This forum was archived on 2017-11-26.