Ok so i stuffed up in the last post. Recursive set-of returning functions are just fine in postgresql. I was just using the wrong return function – you need to use RETURN QUERY. Also, the functions I wrote although useful for part of the problem, don’t help us in others. e.g. we need to know things like ‘give me all of the children of a and b from table x as well as all the children of f, g, and h from table y’. So what was once a couple of simple joins is now turning into more custom functions …
But I guess it’s all a learning experience, haven’t done much pl/pgSQL before.