Ask Your Question
4

How can the PostgreSQL permissions be utilized to turn on/off all triggers?

asked 2022-06-09 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-01-28 07:00:00 +0000

lakamha gravatar image

To turn off all triggers in a PostgreSQL database, you need to revoke the TRIGGER permission from the user or role that owns the triggers. This can be done using the following SQL command:

REVOKE TRIGGER ON ALL TABLES IN SCHEMA public FROM user_or_role;

Replace user_or_role with the name of the user or role that owns the triggers. This command revokes the TRIGGER permission from all tables in the public schema, effectively turning off all triggers in the database.

To turn on the triggers again, you can grant the TRIGGER permission back to the user or role:

GRANT TRIGGER ON ALL TABLES IN SCHEMA public TO user_or_role;

This command grants the TRIGGER permission to all tables in the public schema, allowing the user or role to create and execute triggers.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-06-09 11:00:00 +0000

Seen: 10 times

Last updated: Jan 28 '23