Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id A59429FBAEB for ; Fri, 27 Apr 2007 09:20:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 62402-03 for ; Fri, 27 Apr 2007 09:20:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from web39109.mail.mud.yahoo.com (web39109.mail.mud.yahoo.com [209.191.87.228]) by postgresql.org (Postfix) with SMTP id A4E089FB5D0 for ; Fri, 27 Apr 2007 09:20:05 -0300 (ADT) Received: (qmail 75146 invoked by uid 60001); 27 Apr 2007 12:20:04 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=k+RVAwDc8VH53Cae7EgFq34/Knbmj9U4M3ZMgdcBdu3ZijSc5MxRc/5ZxFyT/LA8zPM9jwIMXb44hcM44AOqQZmQY79jPa2Kh00dr2uuUEGfQ1MK6aQFHzUljfqvzbKdTxOtNDTTr4SAkys8PnwmuQVE6OM02cDSq395n3r/GKY=; X-YMail-OSG: C4FSGhQVM1n6q9kp.TILSys5CPgBiaV10ostY68Q7p_MKTyIwuM88QlIDTyuddc5TQousGDpubFm9iy566Y62brwXdg1mzWiS.aK8jR4BIEMzdAgOQOycbBu7YtP4A-- Received: from [203.215.160.146] by web39109.mail.mud.yahoo.com via HTTP; Fri, 27 Apr 2007 05:20:04 PDT Date: Fri, 27 Apr 2007 05:20:04 -0700 (PDT) From: Altaf Malik Subject: Refcursor bug To: pgsql-jdbc@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-324999708-1177676404=:74662" Content-Transfer-Encoding: 8bit Message-ID: <244181.74662.qm@web39109.mail.mud.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.111 tagged_above=0 required=5 tests=AWL=-0.142, BAYES_00=-2.599, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, HTML_40_50=0.496, HTML_MESSAGE=0.001 X-Spam-Level: * X-Archive-Number: 200704/133 X-Sequence-Number: 16982 --0-324999708-1177676404=:74662 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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 "" does not exist Am i doing something wrong? --Altaf Malik --------------------------------- Ahhh...imagining that irresistible "new car" smell? Check outnew cars at Yahoo! Autos. --0-324999708-1177676404=:74662 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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. --0-324999708-1177676404=:74662--