Populate pgerror and pgcode when the exception is raised
Fixed imports in pool module