X-Original-To: pgsql-sql@postgresql.org Received: from localhost (unknown [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id 2AF419253A5 for ; Thu, 22 May 2003 11:53:15 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 86206-08 for ; Thu, 22 May 2003 11:52:43 -0400 (EDT) Received: from lucifer.akyasociados.com.ar (unknown [200.69.203.237]) by developer.postgresql.org (Postfix) with ESMTP id 5828592570A for ; Thu, 22 May 2003 10:57:46 -0400 (EDT) Received: from demos.oficina (demos.oficina [192.168.1.199]) (authenticated bits=0) by lucifer.akyasociados.com.ar (8.12.9/8.12.9) with ESMTP id h4MF05hW012922; Thu, 22 May 2003 12:00:05 -0300 (ART) (envelope-from franco@akyasociados.com.ar) From: Franco Bruno Borghesi Organization: AK y Asociados S.R.L. To: Tom Lane Subject: Re: function prepared plan Date: Thu, 22 May 2003 12:04:11 -0300 User-Agent: KMail/1.5.1 References: <200303211910.01785.franco@akyasociados.com.ar> <13729.1053571544@sss.pgh.pa.us> In-Reply-To: <13729.1053571544@sss.pgh.pa.us> Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200305221204.11126.franco@akyasociados.com.ar> X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/417 X-Sequence-Number: 13582 Ok Tom, I'll try casting in the testSQL function like you said... but let me ask you another thing: what is plpgsql exactily caching? I mean, in the real case, the testSQL function receives about 10 arguments, and based on theese arguments the function generates the SQL string with very diferent grouping criterias, joins and orders. If plpgsql is caching the plan, I don't think the same plan will work with diferent parameters. Will just casting datatypes do the work? Or should I directly use plctl? Thanks. On Wednesday 21 May 2003 23:45, you wrote: > Franco Bruno Borghesi writes: > > Hi everyone! I have a little problem, and was wondering if anyone > > could help me. > > Change the EXECUTEd query strings so that all the variants return TEXT, > instead of trying to cast after-the-fact. > > If that doesn't seem reasonable, you might be better off working in > pltcl. plpgsql is designed on the assumption that it can cache query > plans from one execution to the next, which is a good speed optimization > but does require a certain amount of stability of datatypes. If you'd > prefer to kiss off speed for flexibility, pltcl is your tool. > > plpython might work too, but I'm not very familiar with it and couldn't > say for certain. > > regards, tom lane