Properly check for connection trouble in the pgsql example