1

I am getting this error " [nativecode=1442 ** Can't update table 'civicrm_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.]" after both migrating my database to another server and upgrading to the 5.19 security upgrade.

I have attempted multiple times to run the trigger rebuild URL for Drupal and to use cv php:eval "CRM_Core_DAO::dropTriggers('civicrm_contact');" cv php:eval "CRM_Core_DAO::triggerRebuild('civicrm_contact');" cv php:eval "CRM_Core_DAO::dropTriggers('civicrm_contribution');" cv php:eval "CRM_Core_DAO::triggerRebuild('civicrm_contribution');" Any ideas of what else to try I would appreciate it.

Thanks, Josh

6
  • Have you tried the standard trigger rebuild? example.com/civicrm/menu/rebuild?reset=1&triggerRebuild=1
    – Aidan
    Nov 26, 2019 at 10:53
  • Yes, I started with that a couple of times before pulling out any code. Thanks!
    – Josh
    Nov 26, 2019 at 15:06
  • Is there any information about what trigger is causing this error? Do you have logging enabled (civicrm/admin/setting/misc?reset=1) What do you get when you run the following sql query? "show triggers like 'civicrm_contact%';" Nov 28, 2019 at 5:40
  • @Luke Strwart, I do not have logging enabled. When I do the query you gave me I get one on insert query that is too long to post here. I tried running the drop triggers again to see if it goes away and it does not. Can I safely drop it? Thanks! Happy Thanksgiving!
    – Josh
    Nov 28, 2019 at 6:08
  • Assuming no customisations are involved it's totally fine to manually delete the trigger then run rebuild triggers via the drupal rebuild. What is the trigger of the error - can you replicate it? What is the calling function? Nov 28, 2019 at 18:02

1 Answer 1

3

You can also use the API with cv, drush, or wp-cli to call System.flush with the parameter triggers=TRUE. E.g. cv api System.flush triggers=TRUE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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