title: PSQL: Purpose of Trigger Function
body: <p>How is trigger function different from 'regular' functions? And is it absolutely necessary in creating a trigger?</p>
  
  <p>For example, in this case: </p>
  
  <pre><code>-- Trigger function
  CREATE FUNCTION update_record_trigger_function() RETURNS trigger
  LANGUAGE plpgsql
  AS $update_record_trigger_function$
  BEGIN
    PERFORM update_record(NEW.oid); -- helper function ... 
    RETURN NEW;
  END
  $update_record_trigger_function$;
  
  -- Trigger for updating latest clicks for posts
  CREATE TRIGGER update_latest_record
  AFTER INSERT OR UPDATE ON record
  FOR EACH ROW
  EXECUTE PROCEDURE update_record_trigger_function();
  </code></pre>
  
  <p>Would it not be simpler to (or is it possible to do):</p>
  
  <pre><code>-- Trigger for updating latest clicks for posts
  CREATE TRIGGER update_latest_record
  AFTER INSERT OR UPDATE ON record
  FOR EACH ROW
  PERFORM update_record(NEW.oid); -- syntactically not right but along this idea
  </code></pre>
  
  <p>I wasn't able to find any document with examples of 'skipping trigger function' or one that explaining how trigger function is special and necessary for triggers? </p>