summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dunstan2009-09-28 17:31:12 +0000
committerAndrew Dunstan2009-09-28 17:31:12 +0000
commit927f9e45c7466df5ed2f821927021730933813f8 (patch)
treedbc3ed6cc94e6f3469de166ca572b4212c657c40
parentbccbcbf697860145434072df271cb84a21fb45eb (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.
-rw-r--r--src/pl/plperl/plperl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index a0293cf801..9762eed523 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -2021,7 +2021,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);