* Peter Maas in "[GENERAL] function to return query result" dated
* 2000/11/29 12:34 wrote:
> Hi,
Hi,
> I tried to write a PL/PGSQL function that returns a query result:
I don't think you can do that yet, but let's look at what you've got.
> CREATE FUNCTION pms() RETURNS pmsummen AS '
> declare
> result pmsummen;
> BEGIN
> select into result * from pmsummen;
> return result;
> END;
> ' LANGUAGE 'plpgsql';
Yeah, the return value of a function can't be a recordset.
> I tried lots of variations of this function (employing PERFORM,
> replacing pmsummen by record, ...) but everything failed. My first
> intention was to write a parameterized view but this doesn't seem to
> exist in PostgresQL so I tried to write a function returning a query
> result. Thanks for your help.
Why don't you use a view? Something like:
create view test as select a.a, a.b, a.c, b.a, b.b
from a, b
where a.id=b.id;
Then you can do selects on the view using a where clause:
select *
from test
where a.a='somevalue';
--
ashley clark