title: Import PostgreSQL triggers on startup. Hibernate
body: <p>I have some stored function and triggers in my PostgreSQL.
  E.g. :</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION log_function() RETURNS TRIGGER AS $logger$
  BEGIN
      IF (TG_OP = 'DELETE') THEN
          INSERT INTO logger SELECT 'D', now(), user, OLD.*;
          RETURN OLD;
      END IF;
      RETURN NULL; 
  END;
  $logger$ LANGUAGE plpgsql;
  </code></pre>
  
  <p>And trigger:</p>
  
  <pre><code>CREATE TRIGGER logging_trigger
  AFTER INSERT OR UPDATE OR DELETE ON some_entity
      FOR EACH ROW EXECUTE PROCEDURE log_function();
  </code></pre>
  
  <p>And I would like import this code after each deploy. (I have <code>&lt;property name="hibernate.hbm2ddl.auto" value="create-drop"/&gt;</code>)</p>
  
  <p>I think it is impossible for functions because its plpgsql, but for triggers it would be great.
  I have been trying added triggers to import.sql, but I have got <code>org.postgresql.util.PSQLException: ERROR: syntax error at end of input</code> </p>
  
  <p>And I don't want to move this code to Java level. </p>
  
  <p>Any ideas?</p>