"Chris Coleman" <ChristopherC(at)eurocom(dot)co(dot)uk> writes:
> When I run the trigger then this error appears in the logs:
> FATAL: BeginInternalSubTransaction: unexpected state END
See
http://archives.postgresql.org/pgsql-committers/2007-05/msg00383.php
regards, tom lane