postgresql has a peculiar behaviour regarding triggers. While in Oracle, for example, trigger body and trigger declaration and association to the table are linked, in PostgreSQL are decoupled. You have function generation, and then creation of trigger, obtained linking table and function.
Problem is that in TDM triggers function are mixed together with all the other non-trigger functions, and inside the table’s trigger there’s only declaration of matching table-trigger function.
This is IMHO cause of troubles.
For example, generating a database, you have to carefully manage dependencies, so that functions are generated AFTER the table (because they reference table fields) but BEFORE the trigger creation. Not really practical. Also when you manage the table you don’t have everything at hand, but you have to search through the functions the trigger function associated. Not practical again.
IMHO trigger functions should be part of the table itself, inside trigger SQL, placed before trigger declaration. Or at least have an option that allows during RE to have trigger functions together with trigger declarations, or separate.