diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:56 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:56 +0000 |
commit | 38da75e1e9a592e27814f83c3166debf2686e3a1 (patch) | |
tree | b38ef7e5c02ecdff41f8b296cd58f5b7c36467b5 /src | |
parent | 5136541a6ac4dd3c79c9e3077c0b0d16362396da (diff) | |
download | postgresql-38da75e1e9a592e27814f83c3166debf2686e3a1.tar.gz postgresql-38da75e1e9a592e27814f83c3166debf2686e3a1.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')
-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 9a64f578f8a..33e06e8c963 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.150 2009/06/11 14:49:14 momjian Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.150.2.1 2009/09/28 17:30:56 adunstan Exp $ * **********************************************************************/ @@ -1995,7 +1995,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); |