X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id AC61CD1B273 for ; Tue, 8 Jun 2004 02:40:46 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 37120-08 for ; Tue, 8 Jun 2004 05:40:38 +0000 (GMT) Received: from smtp813.mail.sc5.yahoo.com (smtp813.mail.sc5.yahoo.com [66.163.170.83]) by svr1.postgresql.org (Postfix) with SMTP id 18A79D1B1D2 for ; Tue, 8 Jun 2004 02:40:36 -0300 (ADT) Received: from unknown (HELO bghthinkpad) (bghcm@sbcglobal.net@68.92.151.112 with login) by smtp813.mail.sc5.yahoo.com with SMTP; 8 Jun 2004 05:40:35 -0000 Message-ID: <001a01c44d1b$131f7160$6400a8c0@bghthinkpad> Reply-To: "Brian G. Huber" From: "Brian G. Huber" To: Subject: Cursor returned from procedure ignores setFetchSize() on CallableStatement Date: Tue, 8 Jun 2004 00:40:14 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.2 tagged_above=0.0 required=5.0 tests=RCVD_IN_NJABL, RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200406/57 X-Sequence-Number: 18002 Hello all - I need to return large result sets and therefore need a cursor with a small fetch size (to avoid caching the entire query at once). However, it appears that when a cursor is returned from a callable statement setFetchSize is ignored. I set up a query that crashes with outofMemoryError if entire query is cached. I am able to sucsessfully use a Statement and setFetchSize() to avoid the crash. However, when I put the code in a procedure, the outofMEmoryError throws before I even try to access the result set, indicating that the entire query is caching. This is true with or without calling setFetchSize on the ResultSet in addition to the CallableStatement. Is this a bug or am I doing something wrong? Any comments greatly appreciated. Thanks Client Code------------------------------------------------------------------------ ----------- cn.setAutoCommit(false); CallableStatement proc = cn.prepareCall("{ ? = call reffunc2('cursor1') }"); proc.setFetchSize(100); proc.registerOutParameter(1, Types.OTHER); proc.execute(); rds = (ResultSet) proc.getObject(1); rds.setFetchSize(100); while (rds.next()){ ... } Function-------------------------------------------------------------------- --------------------------------------------- CREATE OR REPLACE FUNCTION public.reffunc2(refcursor) RETURNS refcursor AS ' BEGIN OPEN $1 FOR SELECT ......; RETURN $1; END; ' LANGUAGE 'plpgsql' VOLATILE;