Re: BUG #5837: PQstatus() fails to report lost connection - Mailing list pgsql-bugs

From Robert Haas
Subject Re: BUG #5837: PQstatus() fails to report lost connection
Date
Msg-id AANLkTimDRAO_xe4h=vL2j0rdGF3_u2uTk0OHmv2rZK+=@mail.gmail.com
Whole thread Raw
In response to Re: BUG #5837: PQstatus() fails to report lost connection  ("Murray S. Kucherawy" <msk@cloudmark.com>)
List pgsql-bugs
On Mon, Jan 24, 2011 at 12:59 AM, Murray S. Kucherawy <msk@cloudmark.com> w=
rote:
> Well my other suggestion would be to assume PGRES_FATAL_ERROR always mean=
s the connection needs to be reset. =A0But this blows that idea away; this =
would cause a connection reset that wouldn't actually solve the problem whe=
n it's an ERROR as you described.

Well, actually it's the other way around: resetting the connection
would *work* in the case of an ERROR, but it'd be overkill.  Most of
the things that can go wrong are ERROR rather than FATAL, and you just
issue a ROLLBACK to balance out any BEGIN you previously issued, and
then do whatever it is you want to do next.  A full connection reset
would be pretty expensive in this context and, as you might guess,
there are a lot more things that cause ERROR than there are that cause
FATAL.

--=20
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgsql-bugs by date:

Previous
From: "Darshana"
Date:
Subject: BUG #5844: maverick
Next
From: Tom Lane
Date:
Subject: Re: BUG #5837: PQstatus() fails to report lost connection