aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plperl/plperl.c
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2009-09-28 17:31:12 +0000
committerAndrew Dunstan <andrew@dunslane.net>2009-09-28 17:31:12 +0000
commit176c3c8db95ee373c0fca412e395eb6a2499e660 (patch)
tree97238b8fc58f46505ff4dea53a97ff3f36e7103a /src/pl/plperl/plperl.c
parent2ad57ee276e4a32124c7c94c347d18f420856855 (diff)
downloadpostgresql-176c3c8db95ee373c0fca412e395eb6a2499e660.tar.gz
postgresql-176c3c8db95ee373c0fca412e395eb6a2499e660.zip
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.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 6a306116038..26847a98a44 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.151 2009/09/16 06:06:12 petere Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.152 2009/09/28 17:31:12 adunstan Exp $
*
**********************************************************************/
@@ -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);