> I want that function to return a list of values (as SQL returns rows of a
> table).
>
> How can I do this?
I am afraid you cannot. Only one row can be returned with the type OPAQUE.
Usually I write a "SELECT functionname(arguments);" query to solve this
problem. The other solution can be that you create a table (outside
your plpgsql function), then fill it out with INSERT statements inside
the plpgsql function. I did not manage to create a table inside the
function and I could not do a few important other things (e.g. CREATE
USER, sub-SELECT), but with a little help of additional sql language
functions was enough for my problem.
You can find a quite complicated implementation of partially ordered sets
on
ftp://pc10.radnoti-szeged.sulinet.hu/home/kovacsz/Linux/PostgreSQL/strukturak/
Here you can find po.sql, this is a basic English translation of the
Hungarian reszbenrendezes.sql file. The table "po" stores only the Hasse
diagram of the partially ordered set.
If you find it worthful, I am glad to contribute it. I hope it does not
work too slow. (Table "po" should be indexed.)
Zoltan