>Another way is: modify the trigger and write informations you need in >a specific table. Not an elegant solution but...
Exactly what I had in mind, but I hoped to be able to log the original statement as well . In that way I can simulate the problem-causing transactions exactly in a more controlled env by running the scripts as in the log table.
You can also make use of the RAISE functionality and output the statement to your logs.
Here's a quick demo
create table footest ( id serial primary key, col1 text, col2 text );
create or replace function do_something() returns trigger as $func$ begin RAISE LOG '%',(ROW(NEW.*)::text); RETURN NEW; end; $func$ language plpgsql;
CREATE TRIGGER footest_trg BEFORE INSERT ON footest FOR EACH ROW EXECUTE PROCEDURE do_something();
-- In the logs: 2014-01-15 07:24:09 PST ... LOG: (1,test1,test2) 2014-01-15 07:24:09 PST ... [INSERT] STATEMENT: insert into footest (col1,col2) values ('test1','test2');