Answers.Body: <p>My theory is you have a table called 'civicrm_group_contact_05Feb20-2049' in the database, maybe a backup whilst you were investigating an issue or something? If you drop this table prior to commencing the upgrade you'll probably have better luck.</p>
  <p>Note that the reason its an issue is that CiviCRM will add audit log triggers to any table prefixed with 'civicrm'. So its trying to add/drop a trigger from that table and falling over. I'm not 100% sure on the reason, looks like trigger names dont support hyphens perhaps. In this case dropping or renaming the table (prefixing it with bkp_ or something) will stop the trigger drop/create failing.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-08T11:22:05.830Z
Answers.Text: I should have spotted that. Thank you very much, removing that table has fixed my issue.
Answers.UserDisplayName: Slingshot Design
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-08-08T10:02:09.147Z
Answers.LastActivityDate: 2020-08-08T10:02:09.147Z
Answers.UserDisplayName: Parvez Saleh
Body: <p>I have tried upgrading to several different versions (5.14.1 up to 5.28) and every time I run the database upgrade, I get a DB Error: syntax error message and can't figure out why.</p>
  <p>Here is an extract from my log file.</p>
  <p>Any help would be most appreciated.</p>
  <p>Aug 08 09:06:01  [error] $Fatal Error Details = Array
  (
  [callback] =&gt; Array
  (
  [0] =&gt; CRM_Core_Error
  [1] =&gt; handle
  )</p>
  <pre><code>[code] =&gt; -2
  [message] =&gt; DB Error: syntax error
  [mode] =&gt; 16
  [debug_info] =&gt; DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]
  [type] =&gt; DB_Error
  [user_info] =&gt; DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]
  [to_string] =&gt; [db_error: message=&quot;DB Error: syntax error&quot; code=-2 mode=callback callback=CRM_Core_Error::handle prefix=&quot;&quot; info=&quot;DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]&quot;]
  </code></pre>
  <p>)</p>
  
Tags: <wordpress><upgrade>
Title: CiviCRM DB Error: syntax error during upgrade in Wordpress
ThreadText: # CiviCRM DB Error: syntax error during upgrade in Wordpress
  
  (Asked by: username_0 on 2020-08-08)
  
  I have tried upgrading to several different versions (5.14.1 up to 5.28) and every time I run the database upgrade, I get a DB Error: syntax error message and can't figure out why.
  Here is an extract from my log file.
  Any help would be most appreciated.
  Aug 08 09:06:01  [error] $Fatal Error Details = Array
  (
  [callback] => Array
  (
  [0] => CRM_Core_Error
  [1] => handle
  )
  [code] => -2
  [message] => DB Error: syntax error
  [mode] => 16
  [debug_info] => DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]
  [type] => DB_Error
  [user_info] => DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]
  [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="DROP TRIGGER IF EXISTS civicrm_group_contact_05Feb20-2049_before_insert [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2049_before_insert' at line 1]"]
  
  )
  
  **Tags:** wordpress, upgrade
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-08-08. Score: 3 | Accepted answer
  
  My theory is you have a table called 'civicrm\_group\_contact\_05Feb20-2049' in the database, maybe a backup whilst you were investigating an issue or something? If you drop this table prior to commencing the upgrade you'll probably have better luck.
  
  Note that the reason its an issue is that CiviCRM will add audit log triggers to any table prefixed with 'civicrm'. So its trying to add/drop a trigger from that table and falling over. I'm not 100% sure on the reason, looks like trigger names dont support hyphens perhaps. In this case dropping or renaming the table (prefixing it with bkp\_ or something) will stop the trigger drop/create failing.
  
  > **Comments:**
  > **username_0**: I should have spotted that. Thank you very much, removing that table has fixed my issue.  
  
  ---
  
  