I have had and solved an error before where MySQL reports "Can't update table 'civicrm_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger". However, in those cases the error was for all transactions. I am getting the same error in my logs but only for some contacts and not others.
I am now seeing the problem when a new new contribution is made by a user of the website for a membership. These users do not have CiivCRM or Drupal admin rights.
I have tried to analyze what is different between contacts that manifest the problem and those that do not. I cannot find a trend. Other contacts that were imported at the time can have donations applied to them, there is no changed based on Financial Types or Payment Method.
The complete error message coming from the log file in ConfigandLog looks like this:
db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::exceptionHandler prefix="" info="INSERT INTO civicrm_contribution
(contact_id
, financial_type_id
, payment_instrument_id
, receive_date
, non_deductible_amount
, total_amount
, fee_amount
, net_amount
, trxn_id
, invoice_number
, currency
, cancel_date
, cancel_reason
, receipt_date
, thankyou_date
, source
, amount_level
, is_pay_later
, contribution_status_id
, check_number
, campaign_id
, tax_amount
) VALUES ( 84941 , 4 , 7 , 20230108161500 , 1 , 1 , 0 , 1 , NULL , 'INV_116130' , 'USD' , NULL , NULL , NULL , NULL , 'This is a test' , 'Contribution Amount - 1' , 0 , 1 , NULL , NULL , 0 ) [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.]"
I have rebuilt the triggers, deleted the triggers and added them back, and upgragraed CiviCRM to 5.56.2.
The database for Drupal and CiviCRM are hosting on Amazon Aurora (MySQL). I have turned on audit logs and do not see anything in the logs that help understand this issue.
Any help with figuring this out is greatly appreciated.
Thanks!