From: Tom Lane Date: Tue, 12 Jul 2005 20:35:42 +0000 (+0000) Subject: Fix plperl crash with list value return for an array result type. X-Git-Tag: REL8_1_0BETA1~320 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d481b31af5ec92a8b940cf8198c5197289aa61e;p=postgresql Fix plperl crash with list value return for an array result type. Reported by Michael Fuhr, fixed by Andrew Dunstan. --- diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c index 664688a32b..3e97fb8755 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.85 2005/07/12 01:16:21 tgl Exp $ + * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.86 2005/07/12 20:35:42 tgl Exp $ * **********************************************************************/ @@ -1020,8 +1020,8 @@ plperl_func_handler(PG_FUNCTION_ARGS) /* Return a perl string converted to a Datum */ char *val; - - if (prodesc->fn_retisarray && SvTYPE(SvRV(perlret)) == SVt_PVAV) + if (prodesc->fn_retisarray && SvROK(perlret) && + SvTYPE(SvRV(perlret)) == SVt_PVAV) { array_ret = plperl_convert_to_pg_array(perlret); SvREFCNT_dec(perlret);