Convert a perl array to a postgres array when returned by Set Returning Functions...
authorAndrew Dunstan <[email protected]>
Mon, 28 Sep 2009 17:31:12 +0000 (17:31 +0000)
committerAndrew Dunstan <[email protected]>
Mon, 28 Sep 2009 17:31:12 +0000 (17:31 +0000)
src/pl/plperl/plperl.c

index a0293cf801fe5e020337852ead0985908b7baf6f..9762eed523a53c265f965c6d4c076c7ef996d2b3 100644 (file)
@@ -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);