diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:24 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:24 +0000 |
commit | 3bf3527fe05d84bb3b4bb1f7c68d9afeaf79d733 (patch) | |
tree | 2051ec1733c5571512cc8fe5918ad2709943658a /src/pl/plperl/plperl.c | |
parent | b3eb458a61bb391fb13e352cc50c414bdfd9dda5 (diff) |
Convert a perl array to a postgres array when returned by Set Returning Functions as well as non SRFs. Backpatch to 8.1 where these facilities were introduced. with a little help from Abhijit Menon-Sen.
Diffstat (limited to 'src/pl/plperl/plperl.c')
-rw-r--r-- | src/pl/plperl/plperl.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index d8edde2fdf4..41862644304 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -1,7 +1,7 @@ /********************************************************************** * plperl.c - perl as a procedural language for PostgreSQL * - * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.6 2009/06/05 20:32:27 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.123.2.7 2009/09/28 17:30:24 adunstan Exp $ * **********************************************************************/ @@ -1960,7 +1960,15 @@ plperl_return_next(SV *sv) if (SvOK(sv)) { - char *val = SvPV(sv, PL_na); + 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); |