inserting arrays from plpgsql. - Mailing list pgsql-sql

From Bhuvan A
Subject inserting arrays from plpgsql.
Date
Msg-id Pine.LNX.4.20.0203061910050.15559-100000@Larry
Whole thread Raw
List pgsql-sql
Dear all,

i am trying to insert an array from a plpgsql function. But it didnt
work and i didnt know where i am wrong. hope to get some lights.

my need is something like this..

create table po
( comp_code text, po_no text, po_details text[]
);    
create table xx
( comp_code text, po_no text, po_line1 text, po_line2 text
);

and my function is..

create function ftest()
returns opaque as 'declare
 array_params po.po_details%type;

begin array_params := {new.po_line1, new.po_line2}; insert into po values (comp_code, po_no, params)
values(new.comp_code,new.po_no, array_params);
 

return new;
end;'
language 'plpgsql';

create trigger ttest after insert on xx for each row execute
procedure ftest();

----

my need is not exactly the same, but very similar.
Will be very happy, if I get some lights!         
Regards,
Bhuvaneswaran.




pgsql-sql by date:

Previous
From: Laszlo Tibor
Date:
Subject: Re: getting pid of backend
Next
From: Bhuvan A
Date:
Subject: assigning values to arrays in plpgsql