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: http://postgresql.1045698.n5.nabble.com/libpq-prevent-automatic-reconnect-tp5735271.html Sent from the PostgreSQL - general mailing list archive at Nabble.com.