Philip Poten <philip.poten@linuxteam.at> writes:
> This is what the FAQ says about it:
> 5.3) How do I write a C function to return a tuple?
> This requires wizardry so extreme that the authors have never tried it,
> though in principle it can be done?
> Is this answer still correct? Is there a way to do it with 7.1?
It's not so much that the wizardry is extreme as that once you've done
it, the resulting function is not all that useful, because there's not
very much you can *do* with a function returning tuples. You might
care to experiment with SQL functions that return tuples to see whether
the system will support what you need to do, before you spend a lot of
effort on replicating their behavior.
In case that wasn't a clear enough hint: to do it, lift appropriate
code from SQL function execution (backend/executor/functions.c).
Be aware that this interface will likely be redesigned whenever we
get around to allowing functions as table sources, which is exactly
the step needed to make such things more conveniently usable. Might
happen for 7.2 ...
regards, tom lane