diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:41 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:41 +0000 |
commit | eff805b588b07988d9072f8e371369cca6ecc523 (patch) | |
tree | f2819af932c14b8dd94f00d14904c7bc89d0f211 | |
parent | 8b720b5723fcd59c22e641e05b62dc92f53c9125 (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.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 50eee09ef13..3437c92b253 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.136.2.2 2009/06/05 20:32:15 adunstan Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.136.2.3 2009/09/28 17:30:41 adunstan Exp $ * **********************************************************************/ @@ -1972,7 +1972,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); |