college

All tags

postgreSQL - Dynamic SQL in trigger-functions for table audit

The problem For a college project I tried to create a pl/pgsql trigger function, which should be invoked by a trigger and then saves the unaltered dataset to an audit table. This task alone is no rocket science and therefore boring. I would have to create a trigger, a trigger function and a log table per auditing table and call the function on ervery update or delete. Instead I aimed for this solution: