Skip to content

Commit 176c3c8

Browse files
committed
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.
1 parent 2ad57ee commit 176c3c8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/pl/plperl/plperl.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**********************************************************************
22
* plperl.c - perl as a procedural language for PostgreSQL
33
*
4-
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.151 2009/09/16 06:06:12 petere Exp $
4+
* $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.152 2009/09/28 17:31:12 adunstan Exp $
55
*
66
**********************************************************************/
77

@@ -2021,7 +2021,15 @@ plperl_return_next(SV *sv)
20212021

20222022
if (SvOK(sv))
20232023
{
2024-
char *val = SvPV(sv, PL_na);
2024+
char *val;
2025+
2026+
if (prodesc->fn_retisarray && SvROK(sv) &&
2027+
SvTYPE(SvRV(sv)) == SVt_PVAV)
2028+
{
2029+
sv = plperl_convert_to_pg_array(sv);
2030+
}
2031+
2032+
val = SvPV(sv, PL_na);
20252033

20262034
ret = InputFunctionCall(&prodesc->result_in_func, val,
20272035
prodesc->result_typioparam, -1);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy