title: Postgres: Which is the order execution of triggers that are specified for different releations but activated by the same event?
body: <p>I'm new to database triggers and I'm stuck with this:</p>
  <p>Suppose that I have two different relations, R1 and R2, for which I specify two &quot;independent&quot; triggers. I mean, trigger TR1 for R1 and TR2 for R2. And suppose that both triggers are fired for the same event.</p>
  <p><strong>Which will be their execution order?</strong></p>
  <p>PostrgresSQL documentation states what happens for triggers defined on the <em>same</em> relation. But it's not clear about triggers defined on different relations, yet fired by the same event. I wonder if, in such situation, triggers are fired in a random order.</p>
  <blockquote>
  <p><a href="http://www.postgresql.org/docs/9.0/static/trigger-definition.html" rel="nofollow noreferrer">36.1. Overview of Trigger Behavior</a>: If more than one trigger is defined <em>for the same event <strong>on the same relation</strong></em>, the triggers will be fired in alphabetical order by trigger name. In the case of before triggers, the possibly-modified row returned by each trigger becomes the input to the next trigger. If any before trigger returns NULL, the operation is abandoned for that row and subsequent triggers are not fired.</p>
  </blockquote>