Commit 2d481b31 authored by Tom Lane's avatar Tom Lane

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

Reported by Michael Fuhr, fixed by Andrew Dunstan.
parent 807bbe60
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment