MySQL Forums
Forum List  »  Triggers

Re: Check for existence of a trigger
Posted by: Arjen Lentz
Date: March 10, 2005 10:34PM

CMS wrote:
> (Using 5.0.2-alpha-max)
> For tables, you can conditionally drop them. That is, drop them if they exist, or do nothing if they
> don't. For example:
> The DROP TRIGGER statement doesn't seem to support the "IF EXISTS" clause. And since attempting
> to drop a trigger that does not exist causes a 1360 error (Trigger does not exist) and aborts my
> script, I can't simply have the script try to drop a trigger without know if it's there or not.

Please make the feature suggestion in (indeed, it's not only for bugs!) so the developers will spot it. It's a good question. Thanks.

> In Oracle, I think I could do a "CREATE OR REPLACE".

Perhaps also add this, it may not be difficult to also support this syntax.

> In SQL Server, I could just peek in the sysobjects table to see if an object exists or not. I don't see
> anything in MySQL where I can look at the object inventory.

The SQL standard way for this, supported in MySQL 5.0, is INFORMATION_SCHEMA.
There will be a INFORMATION_SCHEMA.TRIGGERS in the near future.

Regards, Arjen.
Arjen Lentz, Exec.Director @ Open Query (
Remote expertise & maintenance for MySQL/MariaDB server environments.

Follow us at &

Options: ReplyQuote

Written By
March 10, 2005 04:23PM
Re: Check for existence of a trigger
March 10, 2005 10:34PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.