Add _wrap_db_error support for postgresql

The original "_wrap_db_error" function is only available for mysql.
We need to add support for postgresql.

The deadlock exception thrown from postgresql is TransactionRollbackError,
it's not the same with "OperationalError" thrown from mysql,
and isn't included in sqlalchemy. So, the base exception need to be
catched.

Change-Id: I439a4e0c431c9446ffabd1c93f11b8f509b1ebd7
Closes-Bug: #1270725
Merge "Add _wrap_db_error support for postgresql"