I have a function getitems(id)
which gives all rows that are relevant for this id.
I have a function in PostgreSQL named func1 which should return getitems
over whole list of items:
CREATE OR REPLACE FUNCTION func1(listof_id integer[])
RETURNS SETOF newtype AS
$BODY$
for item in listof_id:
x=plpy.execute("SELECT * FROM getitems(%s)"%item)
return x;
$BODY$
LANGUAGE plpythonu VOLATILE
COST 100;
curently it returns x which contains the values of the last iteration (the getitems
result of the last id in listof_id
). How do I modify it so it will append each iteration to the last?
i tried to do :
x={}
for item in listof_id:
x+=plpy.execute("SELECT * FROM getitems(%s)"%item)
and it doesn't work...