Re: revised patch for PL/PgSQL table functions - Mailing list pgsql-patches

From Tom Lane
Subject Re: revised patch for PL/PgSQL table functions
Date
Msg-id 15599.1030801753@sss.pgh.pa.us
Whole thread Raw
In response to Re: revised patch for PL/PgSQL table functions  (Neil Conway <neilc@samurai.com>)
Responses Re: revised patch for PL/PgSQL table functions  (Neil Conway <neilc@samurai.com>)
List pgsql-patches
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

pgsql-patches by date:

Previous
From: Neil Conway
Date:
Subject: Re: revised patch for PL/PgSQL table functions
Next
From: Gavin Sherry
Date:
Subject: Re: [HACKERS] Proposed GUC Variable