Neil Conway <neilc@samurai.com> writes:
> Given that it's about 4AM here and I just took a 30-sec look at Tom's
> changes to the SRF code, forgive me if this is incorrect: I would
> think that the PL/PgSQL func would examine ReturnSetInfo.expectedDesc
> when processing a SETOF RECORD function, and use that to confirm that
> the RECORD has the appropriate TupleDesc, right?
Actually, it does that already: exec_stmt_return_next relies on the
expectedDesc to check the value being output in all cases. So for a
SETOF RECORD function, the additional work required might be as simple
as just opening up the check in plpgsql_compile to allow RECORD return
type. For the non-SETOF case (table function returning a single tuple),
I think exec_stmt_return would work okay as long as plpgsql_compile had
set fn_retistuple true for RECORD.
But I haven't tested it, and there might be other places in plpgsql that
examine the declared return type and would need tweaking. I have other
fish to fry before beta, so no time...
regards, tom lane