2

After updating from 5.8.2 to 5.9.0, anonymous users suddenly get the above error when trying to register for an event.

Anyone a good hint how to resolve that? Thanks

Debug log shows

Datenbank-Errorcode: Cannot add or update a child row: a foreign key constraint fails (db_local.civicrm_acl_contact_cache, CONSTRAINT FK_civicrm_acl_contact_cache_user_id FOREIGN KEY (user_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_acl_contact_cache ( user_id, contact_id, operation ) VALUES(0, 0, 'View') [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_local`.`civicrm_acl_contact_cache`, CONSTRAINT `FK_civicrm_acl_contact_cache_user_id` FOREIGN KEY (`user_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]
[type] => DB_Error
[user_info] => INSERT INTO civicrm_acl_contact_cache ( user_id, contact_id, operation ) VALUES(0, 0, 'View') [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_local`.`civicrm_acl_contact_cache`, CONSTRAINT `FK_civicrm_acl_contact_cache_user_id` FOREIGN KEY (`user_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_acl_contact_cache ( user_id, contact_id, operation ) VALUES(0, 0, 'View') [nativecode=1452 ** Cannot add or update a child row: a foreign key constraint fails (`db_local`.`civicrm_acl_contact_cache`, CONSTRAINT `FK_civicrm_acl_contact_cache_user_id` FOREIGN KEY (`user_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE CASCADE)]"]

)

  • Are you able to replicate this issue on a sandbox site? – davejenx Jan 10 at 15:49
  • Do you have ACL enabled on site? – Pradeep Nayak Jan 10 at 16:22
  • I use only the Wordpress permission management and have no further ACL enabled. – Andreas Klein Jan 10 at 16:27
  • I have the same problem with 5.8.x to 5.9 upgrade on a contribution page for anon users (Joomla). Error: Database Error Code: Cannot add or update a child row: a foreign key constraint fails (zzz.civicrm_acl_contact_cache, CONSTRAINT FK_civicrm_acl_contact_cache_user_id FOREIGN KEY (user_id) REFERENCES civicrm_contact (id) ON DELETE CASCADE), 1452 Additional Details: Array ( [callback] => Array ( [0] => CRM_Core_Error [1] => handle ) [code] => -3 [message] => DB Error: constraint violation [mode] => 16 [debug_info] => INSERT INTO civicrm_acl_contact_cache ( user_id, contact_id, ope – Nic Jan 16 at 19:26
2

I could solve the problem... I had disabled the Mail module of CiviCRM as I do yet not use it. After reenabling it, the error was gone. Looks like that even disabled modules leave remnants in the database causing possible trouble.

2

This pull request seems relevant to the database error you encountered: (dev/core#660) Address regression whereby Anonymous users can no longer register for an event if they have ACLs to see a contact. This fixes an issue that was I believe introduced in Civi 5.9.0 and fixed in 5.9.1 .

See also related issue Fatal DB Error: already exists on event registration/contribution pages when profile has user creation.

0

We recently upgraded a CiviCRM installation from 4.6 to 5.9.0 and encountered the same issue when trying to register for a membership (contribution page) as anonymous user.

Disabling/enabling the CiviCRM Mail Component didn't fix this.

I removed the foreign keys in the database as a temporary fix:

alter table civicrm_acl_contact_cache drop foreign key FK_civicrm_acl_contact_cache_user_id alter table civicrm_acl_contact_cache drop foreign key FK_civicrm_acl_contact_cache_contact_id

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.