Fixes bug 870092 - Added raised exception in postgres methods.
Merge pull request #1287 from AdrianGaudebert/870092-psycopg-exceptions

Fixes bug 870092 - Added raised exception in postgres methods.