At 2009-09-12 13:17:50 -0400, [email protected] wrote:
>
> I have just noticed, somewhat to my chagrin, that while in a plperl
> function that returns an array type you can return a perl arrayref,
> like this:
>
> return [qw(a b c)];
>
> if the function returns a setof an array type you cannot do this:
>
> return_next [qw(a b c)];
Right. This was an unintentional omission on my part.
> The fix is fairly small (see attached) although I need to check with
> some perlguts guru to see if I need to decrement a refcounter here or
> there.
Slightly simpler patch attached (and tested).
-- ams
*** a/src/pl/plperl/plperl.c
--- b/src/pl/plperl/plperl.c
***************
*** 2021,2027 **** plperl_return_next(SV *sv)
if (SvOK(sv))
{
! char *val = SvPV(sv, PL_na);
ret = InputFunctionCall(&prodesc->result_in_func, val,
prodesc->result_typioparam, -1);
--- 2021,2035 ----
if (SvOK(sv))
{
! char *val;
!
! if (prodesc->fn_retisarray && SvROK(sv) &&
! SvTYPE(SvRV(sv)) == SVt_PVAV)
! {
! sv = plperl_convert_to_pg_array(sv);
! }
!
! val = SvPV(sv, PL_na);
ret = InputFunctionCall(&prodesc->result_in_func, val,
prodesc->result_typioparam, -1);
--
Sent via pgsql-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers