Right, PSQL functions cannot return more than one value or a row from a
table which is a pain. But inside these routines you can do quite a lot.
With PL you can write quite complex functions, and if that is too slow
you can write C routines with SPI and call those. In C routines you can
store the query plan. It really is easy -- just look at the examples in
contrib and the docs.
And if the fact that you cannot get more than one value returned bothers
you -- well, time to roll up your sleeves and fix it. That's what
opensource is all about, after all ;-)
Adriaan