]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Convert a perl array to a postgres array when returned by Set Returning Functions...
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 28 Sep 2009 17:30:04 +0000 (17:30 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 28 Sep 2009 17:30:04 +0000 (17:30 +0000)
src/pl/plperl/plperl.c

index 84076d2b65bf422e37f4c28a689a0c869f07440f..1fe7a6a7b2c2666525b29b2d92d5a9535ba2a7d1 100644 (file)
@@ -33,7 +33,7 @@
  *       ENHANCEMENTS, OR MODIFICATIONS.
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94.2.12 2009/06/05 20:32:41 adunstan Exp $
+ *       $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.94.2.13 2009/09/28 17:30:04 adunstan Exp $
  *
  **********************************************************************/
 
@@ -1805,7 +1805,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 = FunctionCall3(&prodesc->result_in_func,
                                                                PointerGetDatum(val),