title: How to disable PostgreSQL triggers in one transaction only?
body: <p>I need to temporary disable one PostgreSQL trigger in a transaction, but without hardlocking table. Does someone know if it is possible?</p>
  
  <p>Something like this without locking table and disabling trigger outside of this transaction.</p>
  
  <pre><code>BEGIN TRANSACTION;
  
    ALTER TABLE foo DISABLE TRIGGER bar;
  
    -- DO SOME UPDATES ON foo
    UPDATE foo set field = 'value' where field = 'test';
  
    ALTER TABLE foo ENABLE TRIGGER bar;
  
  COMMIT;
  </code></pre>