Fix plperl crash with list value return for an array result type.

Reported by Michael Fuhr, fixed by Andrew Dunstan.
This commit is contained in:
Tom Lane 2005-07-12 20:35:42 +00:00
parent 807bbe6051
commit 2d481b31af
1 changed files with 3 additions and 3 deletions

View File

@ -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);