Tom Lane wrote:
> I think that a reasonable API for this "if PQstatus(conn) is
> CONNECTION_BAD then you had a networking problem". I am not at all sure
> how well libpq honors that definition currently ... but feel free to
> send patches ;-)
As I posted in July,
http://archives.postgresql.org/pgsql-interfaces/2005-07/msg00003.php
the current situation is that libpq goes out of its way to maintain
CONNECTION_OK in these cases. I'd still like to see the fix I outlined
there, which is to treat socket errors as fatal by default (apart from the
special cases for EAGAIN, EINTR and friends that are already there, of
course).
I'm attaching a patch; something similar may be called for in pqSendSome()
as well. A next step would be to factor the code duplication out of the
function, eliminating the redundant error message in the process.
Jeroen