X-Original-To: pgsql-jdbc-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id B2A369FA6BB for ; Sat, 8 Jul 2006 18:55:50 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 48007-06 for ; Sat, 8 Jul 2006 18:55:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id 0F3789FA6B3 for ; Sat, 8 Jul 2006 18:55:44 -0300 (ADT) Received: from 203-118-178-246.bliink.ihug.co.nz ([203.118.178.246] helo=[10.1.1.6]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1FzKm5-0008GZ-Kx; Sun, 09 Jul 2006 09:55:41 +1200 Message-ID: <44B029D6.9000807@opencloud.com> Date: Sun, 09 Jul 2006 09:55:34 +1200 From: Oliver Jowett User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Jeffrey Melloy CC: pgsql-jdbc@postgresql.org Subject: Re: Cursor problems References: <083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org> In-Reply-To: <083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/19 X-Sequence-Number: 15445 Jeffrey Melloy wrote: > I was having trouble doing checkpoint commits on a cursor. It's > possible I'm misunderstanding something basic, but it seems like > commiting on the same connection a cursor is on breaks the cursor. [...] > When I run it, I get the following error after the commit: > ERROR: portal "C_3" does not exist ResultSets aren't guaranteed to stay valid across a commit unless you specify ResultSet.HOLD_CURSORS_OVER_COMMIT when creating the statement (the default is ResultSet.CLOSE_CURSORS_AT_COMMIT). In theory we should actually close the ResultSet in your case (and you'd get a "resultset is closed" exception the next time you used it), but currently we don't do that so instead you see that "portal does not exist" error the next time the ResultSet needs to refill itself from the server. Unfortunately the driver doesn't support HOLD_CURSORS_OVER_COMMIT yet. One simple implementation is just to disable use of cursors internally when HOLD_CURSORS is specified, but that somewhat defeats the purpose.. To do it properly either needs a protocol change so that protocol-created portals can be created WITH HOLD, or we'd need to start using explicit DECLARE CURSOR statements rather than protocol-level portals. -O