If the connection attempt is failed because of some invalid connections options (error like invalid connection options) than calling the PQreset will also fail. But for cases where all arguments to the PQconnectdb were correct and connection was unsuccessful because of reasons like remote server was busy or not accepting the new connections than PQreset will work just fine.
libpq - PQreset when PQconnectdb fails
-
04-12-2021 - |
Question
If I try to establish a connection via PQconnectdb
and it fails, is it ok to call PQreset
on PGconn*
to retry or does it only work if I've already been connected once?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow