Skip site navigation (1) Skip section navigation (2)

Re: BUG #5837: PQstatus() fails to report lost connection

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "Murray S(dot) Kucherawy" <msk(at)cloudmark(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #5837: PQstatus() fails to report lost connection
Date: 2011-01-24 11:55:10
Message-ID: AANLkTimDRAO_xe4h=vL2j0rdGF3_u2uTk0OHmv2rZK+=@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Mon, Jan 24, 2011 at 12:59 AM, Murray S. Kucherawy <msk(at)cloudmark(dot)com> wrote:
> Well my other suggestion would be to assume PGRES_FATAL_ERROR always means the connection needs to be reset.  But this blows that idea away; this would cause a connection reset that wouldn't actually solve the problem when 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.

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

In response to

pgsql-bugs by date

Next:From: Xiaobo GuDate: 2011-01-24 14:02:09
Subject: Re: Is there a way to build PostgreSQL client libraries with MinGW
Previous:From: Andrew DunstanDate: 2011-01-24 09:19:40
Subject: Re: Is there a way to build PostgreSQL client libraries with MinGW

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group