Fix for Postgres template tests.

Made context a named argument at the start of every transaction.