Bug #14249 Would like 'IF EXISTS' clause for DROP TRIGGER
Submitted: 23 Oct 2005 23:51 Modified: 7 Dec 2005 16:27
Reporter: Jeff Donner Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:5.0.13 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[23 Oct 2005 23:51] Jeff Donner
Description:
That I can see, you cannot do: 

  DROP TRIGGER xxx IF EXISTS;

like you can with tables and views; it would be nice to have for error-free batch updates to schemas. 

How to repeat:
Try to drop a non-existent trigger 'xxx'

  DROP TRIGGER xxx IF EXISTS;

and you'll see that the syntax is missing.

mysql> drop trigger xxx;
ERROR 1360 (HY000): Trigger does not exist

mysql> drop trigger xxx IF EXISTS;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS' at line 1

mysql> drop trigger IF EXISTS xxx;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF EXISTS xxx' at line 1

mysql> 

Suggested fix:
Feature request.
[24 Oct 2005 0:28] Jeff Donner
Sorry - when the table gets dropped, so do any triggers. For my purposes that's good enough. There might be some case where someone needs IF EXISTS functionality but, not mine. 

Feel free to delete if you can't imagine it being useful to someone else.