Pavel Stehule <pavel.stehule@gmail.com> writes:
> return next in function that returns composite type needs a composite
> variable. Other cases are not supported there.
Plain "return" has the same limitation, but this really ought to be
fixed sometime. Composite types have been getting closer and closer
to first-class status since plpgsql was written.
regards, tom lane