title: Can a function detect the trigger event type?
body: <p>I am using a function in PostgreSQL 9.1:</p>
  <pre><code>CREATE FUNCTION myfunc() RETURNS trigger AS $$ ... $$ LANGUAGE plpgsql;
  </code></pre>
  <p>with a trigger:</p>
  <pre><code>CREATE TRIGGER mycheck
  BEFORE INSERT OR UPDATE ON t
  FOR EACH ROW EXECUTE PROCEDURE myfunc();
  </code></pre>
  <p>My problem now is to express  a condition about events in the body of that function like (pseudocode):</p>
  <pre><code>IF TRIGGER_EVENT_WAS_INSERT THEN ...doThis... END IF;
  </code></pre>
  <p><strong>How to express this condition?</strong><br />
  (Note <code>BEFORE INSERT OR UPDATE</code> in the trigger!)</p>