Re: bug w/ cursors and savepoints - Mailing list pgsql-hackers

From Oliver Jowett
Subject Re: bug w/ cursors and savepoints
Date
Msg-id 41F9755F.8080006@opencloud.com
Whole thread Raw
In response to Re: bug w/ cursors and savepoints  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
Responses Re: bug w/ cursors and savepoints  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-hackers
Alvaro Herrera wrote:
> On Wed, Jan 26, 2005 at 05:10:09PM -0500, Tom Lane wrote:
> 
> 
>>I don't think we have a lot of choices: we have to destroy (or at least
>>mark FAILED) all such cursors for the time being.
> 
> 
> I don't see a lot of difference between marking the portal FAILED and
> destroying it (maybe I'm looking at the wrong code).  So I just took the
> simpler approach; patch attached.

I assume that you can CLOSE a failed portal, but you can't CLOSE a 
destroyed portal (because it's not there any more)?

This is important for the JDBC driver as it creates portals internally, 
does fetches as the application code demands, then closes the portal at 
some point after the application is done with it. Having the close fail 
because of an intervening savepoint rollback isn't great -- the error 
will cause an unexpected failure of the current transaction. This can 
happen even if the application doesn't try to use the portal (via 
ResultSet) after the savepoint rollback at all.

It wouldn't be so bad if the driver could track savepoint boundaries, 
but the current protocol doesn't make that easy..

-O


pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Permissions on aggregate component functions
Next
From: Tom Lane
Date:
Subject: Re: Strange issue with initdb on 8.0 and Solaris automounts