pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Jeffrey Melloy <jmelloy@visualdistortion.org>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Cursor problems
Date: Sun, 09 Jul 2006 09:55:34 +1200
Message-ID: <44B029D6.9000807@opencloud.com> (raw)
In-Reply-To: <083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org>
References: <083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org>

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



view thread (2+ messages)

Message-ID: <44B029D6.9000807@opencloud.com>
Permalink:  ../44B029D6.9000807@opencloud.com/
Also on:    postgresql.org/message-id/44B029D6.9000807@opencloud.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: oliver@opencloud.com, jmelloy@visualdistortion.org
  Subject: Re: Cursor problems
  In-Reply-To: <44B029D6.9000807@opencloud.com>
  References: <083DBFCC-8EAC-4A5F-BD61-3A82DFC45E5E@visualdistortion.org> <44B029D6.9000807@opencloud.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox