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 2695BD1B262 for ; Fri, 23 Jul 2004 01:15:21 -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 07859-05 for ; Fri, 23 Jul 2004 04:15:26 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id AC1CBD1B233 for ; Fri, 23 Jul 2004 01:15:18 -0300 (ADT) Received: from flood.opencloud.co.nz ([192.168.0.31] helo=opencloud.com) by yass.opencloud.co.nz with esmtp (Exim 3.35 #1 (Debian)) id 1BnrSq-0001XC-00; Fri, 23 Jul 2004 16:15:20 +1200 Message-ID: <410090D7.7030900@opencloud.com> Date: Fri, 23 Jul 2004 16:15:19 +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> <40FFA5C0.7050701@opencloud.com> <9813.1090509192@sss.pgh.pa.us> In-Reply-To: <9813.1090509192@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.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/1126 X-Sequence-Number: 56687 Tom Lane wrote: > Hm. The copying bit bothers me, and I guess after some thought it's > a semantic issue. If you've got > > DECLARE c CURSOR FOR SELECT ... WHERE foo = $1; > > FETCH 10 FROM c; > > it's not very clear when the value of $1 should be supplied. With your > proposal the parameter value would have to be supplied in the Bind > message for the DECLARE CURSOR command. That may be the only way to do > it (certainly I'd not want several successive FETCHes to use different > parameter values), but it still seems a bit weird. It doesn't seem too weird, we're using Parse/Bind to separate the query template from concrete parameter values. When the Bind is done, we want to behave as if executing the DECLARE with actual parameter values substituted into the query string originally -- that matches the behaviour of Bind for other queries. So using the parameters to DECLARE for the constructed portal seems right. If we were to do it any other way, we'd have to special-case Parse or Bind for DECLARE to expect some different (zero?) number of parameters in the Bind. exec_bind_message does a check quite early on that the number of parameters provided matches the number expected. > BTW, rather than hacking the parameter list of ProcessUtility, > I'd be inclined to just look at ActivePortal->portalParams in > PerformCursorOpen. (Come to think of it, we could also copy > ActivePortal's sourceText at the PortalDefineQuery step.) Ok, I'll do that. -O