Bug #51038 DROP TRIGGER IF NOT EXISTS not properly being formatted in MySQL Backup
Submitted: 9 Feb 2010 18:18 Modified: 9 Feb 2010 18:56
Reporter: Kent Lewandowski Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Administrator Severity:S3 (Non-critical)
Version:1.2.17 OS:Windows
Assigned to: CPU Architecture:Any
Tags: drop trigger

[9 Feb 2010 18:18] Kent Lewandowski
Description:
When I run a RESTORE from a MySQL backup .sql file for a database that has some TRIGGERs configured, I have to manually delete all DROP TRIGGER statements from the backup file in order to complete the restore.  Otherwise I get the following error message :

Error while executing this query:DROP TRIGGER /*!50030 IF EXISTS */ <name of table with configured trigger>;

The server has returned this error message:Trigger does not exist
MySQL Error.

I believe there are 3 possible causes for the error:
1) User error (me)
2) DROP TRIGGER IF EXISTS statement does not appear to work (not sure why there are those /*!50030 comments)
3) Once the table is dropped and recreated for which a TRIGGER exists, the statement DROP TRIGGER no longer works.

How to repeat:
1. Create a TRIGGER for any table on the update / insert / delete event.
2. Create a backup file using MySQL Administrator 1.2.17 (choose option InnoDB Online Backup)
3. Choose option ADD DROP STATEMENTS.
4. Run the utility to create the backup .sql file.
5. Examine the .sql file and look for DROP TRIGGER /*!50030 IF EXISTS */
6. Once you confirm that this statement has been included, attempt to run a RESTORE to the database using MySql Administrator.  You should get the error mentioned above.

Suggested fix:
Perhaps the product can be changed so that DROP TRIGGER statements are never created?
[9 Feb 2010 18:25] Valeriy Kravchuk
We do not fix any bugs in MySQL Administrator any more (check http://dev.mysql.com/support/eol-notice.html). 

Please, check if the same problem is repeatable with MySQL Workbench 5.2.15 that is going to replace old GUI Tools.
[9 Feb 2010 18:39] Kent Lewandowski
Valeriy, thanks for the quick reply.  As I do not have MySQL 5.2 workbench installed, and the MySQL Administator is otherwise working fine, I do not plan to install it until absolutely necessary.  Therefore I will not be able to run this check / test on workbench 5.2.  I would request that you run this check yourself.  It should not be hard to do.  Thank you.
[11 Oct 2010 8:03] Arjen Iedema
I got the same sort of error, through commandline import and in MySQL Administrator.
Workbench is even worse: that gives an error while even clicking on the import/export button: AttributeError: 'NoneType' object has no attribute 'parameterValues'

Could you pls make a program that WORKS?