Reported by Michael Fuhr, fixed by Andrew Dunstan.
* 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 $
*
**********************************************************************/
/* 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);