diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:04 +0000 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2009-09-28 17:30:04 +0000 |
commit | fa990959f453a84e3aab11b24b10e0eea75471bc (patch) | |
tree | 9c62b040c784cbe83b041d80f976b65ae6c2b195 /src | |
parent | ece0f720d0b94c667fb85a7ea1864d3266a59a54 (diff) | |
download | postgresql-fa990959f453a84e3aab11b24b10e0eea75471bc.tar.gz postgresql-fa990959f453a84e3aab11b24b10e0eea75471bc.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 84076d2b65b..1fe7a6a7b2c 100644 --- a/src/pl/plperl/plperl.c +++ b/src/pl/plperl/plperl.c @@ -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), |