Rahul Raj
Rahul Raj

Reputation: 3459

Query to disable triggers for a particular user in Postgres

Here is the query to disable all triggers in a particular table:

alter table plan_items DISABLE TRIGGER ALL

But I'm getting access issues while executing the query. How do we execute the same query passing for a particular database user? I want to delete triggers that are only part of the mentioned database user.

Upvotes: 0

Views: 556

Answers (2)

Rahul Raj
Rahul Raj

Reputation: 3459

Seems like the below query does the exact job:

ALTER TABLE table DISABLE TRIGGER USER;

This will disable normal triggers added by the database user.

Upvotes: 0

Laurenz Albe
Laurenz Albe

Reputation: 247950

You can configure a user so that ordinary triggers won't fire for it:

ALTER ROLE myuser SET session_replication_role = replica;

Upvotes: 1

Related Questions