Mainly I am looking for implementing some kind of stored views/reports but with parameters so you can easily update them.
I tried to folow the instructions from http://wiki.postgresql.org/wiki/Return_more_than_one_row_of_data_from_PL/pgSQL_functions but so far I wasn't able to get a list of results back.
CREATE OR REPLACE FUNCTION myreport(in TEXT) returns setof TEXT AS
$$
select * from ... where ... = '$1'
$$
language sql;
select * from myreport('XOP');
While the internal SQL works well and returns the desired results, it seems that the function execution returns only one item, instead of a list of rows (in my case the select returns a single text column).
plpgsql