# Database Syntax Error when attempting upgrade

I have a website that is on Drupal 7 and I am attempting to upgrade the version of Civi from 5.10 to 5.13 but when I attempt to upgrade it, I'm receiving the following error:

Database Error Code: 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 '-b_before_insert' at line 1, 1064


I have tried doing the upgrade through drush and also through the /civicrm/upgrade URL with the same error.

It's a bit of a long shot but I was hoping that someone has seen the error before and knows of a fix or how I can determine exactly what is going on.

Taking a look at the debugging information, I can see it has something to do with triggers:

DROP TRIGGER IF EXISTS civicrm_saved_search-b_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 '-b_before_insert' at line 1]


After a lot of digging, I realised what was happening. For some reason, there was a second civicrm_saved_search table in the database named civicrm_saved_search-b .
That hyphen - is an 'illegal' character unless you escape it.
To resolve the issue, all I did was change the - to a _ which cleared everything up and enabled me to upgrade my site within minutes.