Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 47CE3633BBF for ; Thu, 11 Jun 2009 20:02:54 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 81179-01 for ; Thu, 11 Jun 2009 20:02:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from QMTA04.emeryville.ca.mail.comcast.net (qmta04.emeryville.ca.mail.comcast.net [76.96.30.40]) by mail.postgresql.org (Postfix) with ESMTP id 8E975633927 for ; Thu, 11 Jun 2009 20:02:52 -0300 (ADT) Received: from OMTA07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by QMTA04.emeryville.ca.mail.comcast.net with comcast id 2mMg1c00A1GXsucA4n2r7h; Thu, 11 Jun 2009 23:02:51 +0000 Received: from dbn8.local ([98.246.113.228]) by OMTA07.emeryville.ca.mail.comcast.net with comcast id 2n2p1c00L4vjreA8Tn2q31; Thu, 11 Jun 2009 23:02:51 +0000 From: Richard Rosenberg Reply-To: Richard Rosenberg To: Tom Lane Subject: Re: polymorphic function in 7.4 vs. 8.3 Date: Thu, 11 Jun 2009 16:02:48 -0700 User-Agent: KMail/1.9.9 Cc: pgsql-sql@postgresql.org References: <200906111442.17861.richrosenberg@earthlink.net> <20491.1244756986@sss.pgh.pa.us> In-Reply-To: <20491.1244756986@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906111602.48353.richrosenberg@earthlink.net> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200906/59 X-Sequence-Number: 32664 On Thursday 11 June 2009 14:49:46 Tom Lane wrote: > Sure you can't move the DB off 7.4? There would be pretty considerable > benefits from adopting some recent release instead. > > regards, tom lane Don't I know it. I am SOL as the machine is hosted/shared out by an external provider. I can do it by getting rid of the polymorphism - breaking the columns into separate args - as you say: CREATE OR REPLACE FUNCTION public.test1_trg() RETURNS "trigger" AS ' DECLARE some_rec public.atest1; BEGIN some_rec.id := NEW.id; some_rec.descr := NEW.descr; select into some_rec * from dd_test(some_rec.id, some_rec.descr, TG_RELNAME) as (id int, descr text); --some_rec := dd_test(some_rec)::public.atest1; RETURN some_rec; END; ' LANGUAGE 'plpgsql' VOLATILE; CREATE OR REPLACE FUNCTION public.dd_test(int, text, text) RETURNS record AS ' DECLARE any_id alias for $1; any_descr alias for $2; tablename alias for $3; some_id integer; some_descr text; some_row record; BEGIN some_id := any_id; if some_id < 0 then raise notice ''id is < 0!''; some_descr := ''some other value''; end if; for some_row in execute ''select * from ''||tablename||'' where 1 = 0'' loop end loop; some_row.id := some_id; some_row.descr := some_descr; RETURN some_row; END; ' LANGUAGE 'plpgsql' VOLATILE; Oh well, I'm glad I tested the approach out before going too far down this road. Thanks again for your timely help. Richard