title: How to obtain primary key value in trigger function if primary key column name is unknown?
body: <p>I'm using postgres.
  Let's say I'm going to create following trigger:</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION auditlogfunc() RETURNS TRIGGER AS $example_table$
     BEGIN
        INSERT INTO AUDIT(EMP_ID, ENTRY_DATE) VALUES (new.ID, current_timestamp);
        RETURN NEW;
     END;
  $example_table$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>I want to use this trigger with many tables and not every table has primary key with name 'id' (table can have no 'id' column at all).
  So I need to find out in some way how to use primary key in my trigger function no matter which column name it has.
  How can I achieve this?</p>