libpq will automatically reconnect if the connection is dropped.
auto con = PQconnectdb("info"); while (true) { PQclear(PQexec(con, "SELECT * FROM foo LIMIT 1")); std::this_thread::sleep_for(std::chrono::seconds(1)); std::cout << "here " << i++ << std::endl; }
$ sudo ifconfig eth0 down
output stops
$ sudo ifconfig eht0 up
output resumes
is there a way to disable this behaviour?
View this message in context:
libpq - prevent automatic reconnect Sent from the
PostgreSQL - general mailing list archive at Nabble.com.