From: | Richard Rosenberg <richrosenberg(at)earthlink(dot)net> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: polymorphic function in 7.4 vs. 8.3 |
Date: | 2009-06-11 23:02:48 |
Message-ID: | 200906111602.48353.richrosenberg@earthlink.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Rob Sargent | 2009-06-11 23:16:30 | Re: polymorphic function in 7.4 vs. 8.3 |
Previous Message | Tom Lane | 2009-06-11 21:49:46 | Re: polymorphic function in 7.4 vs. 8.3 |