3

I am using CiviCRM(4.6.10) with Drupal (7.38) together with the civicrm_og_sync module. Until now everything worked fine:

Everytime a drupal user was created automatically a civi contact was also created. Then I deleted a user account on drupal and the corresponding contact in civi (full deletion!).

Now when I try to create a new user in drupal I get the following error:

Datenbank-Errorcode: Cannot add or update a child row: a foreign key constraint fails (civi_db.civicrm_log, CONSTRAINT FK_civicrm_log_modified_id FOREIGN KEY (modified_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE), 1452 Zusätzliche 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' , 381 , 'civicrm_contact,381' , 374 , 20160111141559 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (civi_db.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 , data , modified_id , modified_date ) VALUES ('civicrm_contact' , 381 , 'civicrm_contact,381' , 374 , 20160111141559 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (civi_db.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 , data , modified_id , modified_date ) VALUES ('civicrm_contact' , 381 , 'civicrm_contact,381' , 374 , 20160111141559 ) [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (civi_db.civicrm_log, CONSTRAINT FK_civicrm_log_modified_id FOREIGN KEY (modified_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE)]"] )

In the end the drupal user is created but not the civi contact. I looked into the tables 'civicrm_contact' and 'civicrm_log' but couldn't find anything supicious - an id or modified_id with number 381 did not exist. On the other hand I can still create a contact with the civi user-interface...

What can I do?

2

It looks like civicrm is trying to record the change as being done with a different id than the contact that is trying to register (381 vs 374)

Are you sure you are properly anonymous? it might be that your site still think you are "someone else" (eg. the contact you deleted?).

Could you try creating a new account from a "clean" computer, or if you can't, try doing it with your computer, but from an anonymous session (each browser has a different way of doing that, in firefox, it's File->New Private window) and see if you experience the same issue?

and if you do, could you temporarily disable the og_sync, to try to narrow down where the problem comes from?

X+

  • Wohooo!! You are right. I simply took another browser (chrome instead of firefox) and it works again! Strange - since I took firefox's private mode, so I thought cookies cant be the problem... So my paranoia was unjustified.Thanks ! – pedral Jan 11 '16 at 14:19
0

Logging out and back in solved the problem for me.

I had deleted a contact (probably associated contact with the logged in user). And then I began seeing this error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.