CLC-1671 Recover from PostgreSQL connection failure if possible

https://jira.media.berkeley.edu/jira/browse/CLC-1671