Solved: How to disable all Triggers/Constraints in PostgreSQL Temporarily
Some time ago I had a complex SQL query in PostgreSQL that required having all Triggers & Constraints disabled temporarily.
This can be achieved using the following commands as a PostgreSQL Super User:
Disable All Triggers/Constraints
SET session_replication_role = 'replica';
Alternative Solution
Because the commands that were mentioned require the "super user"-role, I also have an alternative solution!
SET CONSTRAINTS ALL DEFERRED;
Enable All Triggers/Constraints (Revert)
SET session_replication_role = 'origin';