BUG: Infinite loop on failed connect to a postgresql server

When a postgres db server is down or credentials are wrone, the adapter still tries to check for a existing database and loops back into trying to connect again.