From: Dave Cramer <pg@fastcrypt.com>
To: Altaf Malik <mmalik_altaf@yahoo.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Refcursor bug
Date: Fri, 27 Apr 2007 08:40:34 -0400
Message-ID: <E8896A9E-6102-4733-B0BA-0322028B7821@fastcrypt.com> (raw)
In-Reply-To: <244181.74662.qm@web39109.mail.mud.yahoo.com>
References: <244181.74662.qm@web39109.mail.mud.yahoo.com>
Did this work in previous versions ?
I made a change recently which closes the refcursor immediately after
reading it, because it was leaking on large batches
Dave
On 27-Apr-07, at 8:20 AM, Altaf Malik wrote:
> Hi,
> I encountered a bug with refcursors with the latest JDBC driver. I
> cannot get two refcursors as OUT parameter if both of them point to
> the same underlying refcursor.
>
> Steps to produce:
> 1- Create table:
> CREATE TABLE testref ( a int4, b varchar);
>
> 2-Create the function:
> CREATE OR REPLACE FUNCTION reftwo(
> A OUT REFCURSOR, B OUT REFCURSOR)
> RETURNS record AS $$ DECLARE
> V_REF REFCURSOR;
> BEGIN
> OPEN V_REF FOR SELECT * FROM testref;
> A:=V_REF;
> B:=V_REF;
> END; $$ LANGUAGE 'plpgsql'
>
> 3- Run the following code:
>
> con.setAutoCommit(false);
> CallableStatement stm = con.prepareCall("{call reftwo(?,?)}");
> stm.registerOutParameter(1,Types.OTHER);
> stm.registerOutParameter(2,Types.OTHER);
> stm.execute();
> ResultSet rs = (ResultSet) stm.getObject(1);
> ResultSet rs2 = (ResultSet) stm.getObject(2);
> con.setAutoCommit(true);
>
> When i execute this code, it reports the following problem:
> org.postgresql.util.PSQLException: ERROR: cursor "<unnamed portal
> 1>" does not exist
>
> Am i doing something wrong?
>
> --Altaf Malik
>
> Ahhh...imagining that irresistible "new car" smell?
> Check out new cars at Yahoo! Autos.
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: pg@fastcrypt.com, mmalik_altaf@yahoo.com
Subject: Re: Refcursor bug
In-Reply-To: <E8896A9E-6102-4733-B0BA-0322028B7821@fastcrypt.com>
References: <244181.74662.qm@web39109.mail.mud.yahoo.com> <E8896A9E-6102-4733-B0BA-0322028B7821@fastcrypt.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