X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1F33D1B211 for ; Thu, 22 Jul 2004 08:32:13 -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 72181-06 for ; Thu, 22 Jul 2004 11:32:19 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 372C9D1B20D for ; Thu, 22 Jul 2004 08:32:11 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=opencloud.com) by yass.opencloud.co.nz with asmtp (Exim 3.35 #1 (Debian)) id 1Bnbo9-0007gh-00; Thu, 22 Jul 2004 23:32:17 +1200 Message-ID: <40FFA5C0.7050701@opencloud.com> Date: Thu, 22 Jul 2004 23:32:16 +1200 From: Oliver Jowett User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6b) Gecko/20031205 Thunderbird/0.4 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Tom Lane Cc: pgsql-hackers@postgresql.org Subject: Re: [JDBC] V3 protocol + DECLARE problems References: <40FD982D.2080006@opencloud.com> <9141.1090424549@sss.pgh.pa.us> In-Reply-To: <9141.1090424549@sss.pgh.pa.us> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200407/1110 X-Sequence-Number: 56671 Tom Lane wrote: [... DECLARE with parameters failing ...] >>Any chance of getting this fixed for 7.5? > > > I'm up to my keister in PITR and nested-xact issues and won't have time > to look at it soon. Do you want to take a look and see if you can find > where the ball is getting dropped? Here's what I've found so far: The error occurs where it does because it is a DECLARE CURSOR WITH HOLD outside an explicit transaction, so the resulting cursor is immediately materialized when the implicit commit at end of statement happens. This implicitly fetches all rows, and it's the fetch that fails. When the DECLARE is enclosed in an explicit transaction, it succeeds, but then subsequent FETCHes fail with the same error. DECLARE -> PerformCursorOpen always passes NULL as a parameter list to PortalStart() on the newly created portal, so no parameters are available when executing it. It seems like we should pass the original parameters from execution of the DECLARE utility portal down through PortalRunUtility -> ProcessUtility -> PerformCursorOpen, copy them into the newly created portal's memory context, and pass the copies to PortalStart on the new portal. Does that sound about right? -O