Ashley Moran <work(at)ashleymoran(dot)me(dot)uk> writes:
> ... All of which is easy with table variable, but I can't see how to
> translate it to PL/pgsql. Is there any way to manipulate result sets
> in a set-based manner like this?
Sure: use a table. What was the objection to temp tables exactly?
regards, tom lane