← Back to team overview

maria-developers team mailing list archive

Re: MDEV-7286 TRIGGER: CREATE OR REPLACE, CREATE IF NOT EXISTS

 

Hi Peter,

On Mon, Feb 9, 2015 at 9:26 AM, Peter Laursen <peter_laursen@xxxxxxxxxx> wrote:
>
> As regards TRIGGERS in MySQL I am very much missing what PostgreSQL (and
> maybe other RDBMS as well) has: an option to [temporarily] disable
> TRIGGGER[S] for all or specific users - like listed in PostgreSQL docs:
> (http://www.postgresql.org/docs/9.2/static/sql-altertable.html)
>
> ALTER TABLE
> ..
> DISABLE TRIGGER [ trigger_name | ALL | USER ]
> ENABLE TRIGGER [ trigger_name | ALL | USER ]
> ..
>
> A TRIGGER may work fine with the application it was designed to be used
> with. But you may need to do some manual maintenance and then it is not
> always desirable that TRIGGERS will fire. It can actually start a chain of
> unwanted changes that can be very dificult to correct (unless you resort to
> the brutal solution of taking the database offline, dropping TRIGGERS, do
> the maintenance and recreate the TRIGGERS).
>

I agree that MySQL and MariaDB could benefit from some method to
disable triggers for a particular session or user.

However, I think you may have slightly misunderstood PostgreSQL's
documentation. Going over the usage of these commands in PostgreSQL:

ALTER TABLE foo DISABLE TRIGGER USER;

The above command doesn't disable all triggers on the table for a
particular user. It disables all user-created triggers on the table
for all users.

ALTER TABLE foo DISABLE TRIGGER ALL;

The above command disables all triggers on the table for all users,
including triggers generated by the system to enforce things like
check constraints, foreign key constraints, etc.

Anyway, I submitted a feature request on the JIRA for a feature like
this. Feel free to vote for the issue or to add comments to the issue
about what you would like this feature to look like.

https://mariadb.atlassian.net/browse/MDEV-7579

Geoff


References