Handle PostgreSQL errors.