X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 1D87452814 for ; Wed, 15 Jun 2005 01:46:16 -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 79931-09 for ; Wed, 15 Jun 2005 04:46:12 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [203.79.85.162]) by svr1.postgresql.org (Postfix) with ESMTP id 3874C52874 for ; Wed, 15 Jun 2005 01:46:10 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1DiPn0-0001Ft-Bf; Wed, 15 Jun 2005 16:46:10 +1200 Message-ID: <42AFB291.6070405@opencloud.com> Date: Wed, 15 Jun 2005 16:46:09 +1200 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050324) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Dave Cramer Cc: List Subject: Re: patch for passing the cts References: <2BC23AE7-6381-41BA-AE89-CC81D1C932A7@fastcrypt.com> <42AF6682.6000405@opencloud.com> In-Reply-To: X-Enigmail-Version: 0.90.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/76 X-Sequence-Number: 13038 Dave Cramer wrote: > Do you have any suggestions ? Also, the parser for {call} is going to have to get a lot smarter. A first cut at what it needs to do.. Extract this information from the query: - Name of the called function - Number of ? parameter placeholders - Text of each function argument - Mapping from parameter index to function argument (many-to-one) - Eligibility of each parameter for being an OUT parameter (this can be determined from the text the parameter maps to -- if it's a bare "?" then it's eligible) On execute, you reassemble a query from the IN function arguments text only. e.g. for the query "{call f(?+?,?)}" you'll get: function = "f" 3 parameters 2 function arguments: argument 1 = "?+?" argument 2 = "?" parameter 1 maps to function arg 1 and can't be OUT parameter 2 maps to function arg 1 and can't be OUT parameter 3 maps to function arg 2 and can be OUT If you set all 3 parameters as IN parameters, it assembles a SELECT including all function arguments: "select * from f(?+?,?) as result" and gives it to the query executor which executes: "select * from f($1+$2,$3) as result" If you set parameter 3 to OUT, it excludes the corresponding function argument (argument 2) when assembling the SELECT: "select * from f(?+?) as result" resulting in the actual query: "select * from f($1+$2) as result" Hmm.. perhaps you could get a similar effect by doing the normal query fragmentation then stripping a comma (only) from one of the adjacent fragments to an OUT parameter, then merging the two adjacent fragments as you remove the parameter; but that seem pretty hairy.. -O