title: PostgreSQL trigger not working - neither BEFORE nor AFTER DELETE
body: <p>I have just left MySQL behind in favor of PostgreSQL, and I have a question regarding triggers. This trigger is designed to update a field in the 'workflow' table if a row is deleted in the 'processes' table.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION fn_process_delete() RETURNS TRIGGER AS $$
  BEGIN
      UPDATE workflow SET deleted_process_name = OLD.process_name
      WHERE process_id = OLD.process_id;
      RETURN NULL;
  END;
  $$ LANGUAGE plpgsql;
  
  DROP TRIGGER IF EXISTS process_delete ON processes;
  CREATE TRIGGER process_delete
  AFTER DELETE ON processes
  FOR EACH ROW 
  EXECUTE PROCEDURE fn_process_delete();
  </code></pre>
  
  <p>My question is two-fold:</p>
  
  <ol>
  <li><p>If I use AFTER DELETE as above, the row will delete, but the update statement does not update the field in the 'workflow' table. </p></li>
  <li><p>If I use BEFORE DELETE, the processes table will not perform the delete at all and delivers an error saying "No unique identifier for this row".</p></li>
  </ol>
  
  <p>Can anyone advise?</p>