Body: <p>I have an error happening in both my dev and production sites. I have attempted everything I can think of such as clearing the cache, rebuilding the menus, deleted and recreated triggers, upgradded to CiviCRM 4.43, and probably a few other things.</p>
  <p>When saving a membership contribution I get this error.</p>
  <p><code>$Fatal Error Details = array:3 [ &quot;message&quot; =&gt; &quot;DB Error: unknown error&quot; &quot;code&quot; =&gt; null &quot;exception&quot; =&gt; PEAR_Exception {#2259 #cause: DB_Error {#2265 +error_message_prefix: &quot;&quot; +mode: 16 +level: 1024 +code: -1 +message: &quot;DB Error: unknown error&quot; +userinfo: &quot;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` , `receipt_date` , `source` , `contribution_status_id` , `check_number` , `campaign_id` , `tax_amount` ) VALUES ( 18203 , 2 , 4 , 20211109145000 , NULL , 200.00 , 0 , 200 , NULL , 'INV_101203' , 'USD' , NULL , 'TEST' , 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.]&quot;</code></p>
  <p>The crux of this is &quot;Can't update table 'civicrm_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger.&quot;</p>
  <p>I am not sure where to go from here. Any advice is greatly appreciated.</p>
  <p>The database server is an RDS instance running MySQL.</p>
  <p>Thanks,
  Josh</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-15T20:58:28.087Z
Comments.Text: It's confusing that it's trying to update civicrm_contact. Can you do `show triggers like 'civicrm_contribution'`?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-11-17T04:47:09.173Z
Comments.Text: @Demerit, I have gotten the system working by taking out the trigger for contributions. The trigger has not changed in about a year but this problem is new. The query is over 2K characters so I can not include it here.  I did upload it to S3: https://onlinesharing18.s3.us-west-2.amazonaws.com/civicrm_contribution_trigger.sql Thanks!
Comments.UserDisplayName: Josh
Tags: <civicontribute><civimember><database>
Title: Database Errors When Recording Membership Contributions
ThreadText: # Database Errors When Recording Membership Contributions
  
  (Asked by: username_0 on 2021-11-09)
  
  I have an error happening in both my dev and production sites. I have attempted everything I can think of such as clearing the cache, rebuilding the menus, deleted and recreated triggers, upgradded to CiviCRM 4.43, and probably a few other things.
  
  When saving a membership contribution I get this error.
  
  `$Fatal Error Details = array:3 [ "message" => "DB Error: unknown error" "code" => null "exception" => PEAR_Exception {#2259 #cause: DB_Error {#2265 +error_message_prefix: "" +mode: 16 +level: 1024 +code: -1 +message: "DB Error: unknown error" +userinfo: "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` , `receipt_date` , `source` , `contribution_status_id` , `check_number` , `campaign_id` , `tax_amount` ) VALUES ( 18203 , 2 , 4 , 20211109145000 , NULL , 200.00 , 0 , 200 , NULL , 'INV_101203' , 'USD' , NULL , 'TEST' , 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.]"`
  
  The crux of this is "Can't update table 'civicrm\_contact' in stored function/trigger because it is already used by statement which invoked this stored function/trigger."
  
  I am not sure where to go from here. Any advice is greatly appreciated.
  
  The database server is an RDS instance running MySQL.
  
  Thanks,
  username_0
  
  **Tags:** civicontribute, civimember, database
  
  > **Comments:**
  > **username_1**: It's confusing that it's trying to update civicrm_contact. Can you do `show triggers like 'civicrm_contribution'`?  
  > **username_0**: @username_1, I have gotten the system working by taking out the trigger for contributions. The trigger has not changed in about a year but this problem is new. The query is over 2K characters so I can not include it here.  I did upload it to S3: https://onlinesharing18.s3.us-west-2.amazonaws.com/civicrm_contribution_trigger.sql Thanks!  
  
  ---
  
  ## 0 answers
  
  