Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable triggers in PostgreSQL 9?

In PostgreSQl 8.x to disable triggers I do something like:

ALTER TABLE table DISABLE TRIGGER ALL;

When I do this in PostgreSQL 9 I get the following:

my_database=> ALTER TABLE my_table DISABLE TRIGGER ALL;
ERROR:  permission denied: "RI_ConstraintTrigger_25366" is a system trigger

PS: This table was created by the user that is running this command.

Any clues on this?

like image 568
André Avatar asked Oct 18 '11 10:10

André


1 Answers

Some triggers are added automatically to enforce constraints, and those can't be disabled unless you are a superuser. If you only want to disable the normal triggers which you have added then do this:

ALTER TABLE table DISABLE TRIGGER USER;
like image 98
TomH Avatar answered Oct 28 '22 08:10

TomH