Postgresql commit transaction in function. But you can't have a commit or rollback .