Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a45641d

Browse files
committed
Fix incorrect test for whether Perl code is returning undef. This
allows plperl routines to return NULL as intended.
1 parent 386f180 commit a45641d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/pl/plperl/plperl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
* ENHANCEMENTS, OR MODIFICATIONS.
3434
*
3535
* IDENTIFICATION
36-
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.26 2001/11/05 17:46:39 momjian Exp $
36+
* $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.27 2002/01/24 16:53:42 tgl Exp $
3737
*
3838
**********************************************************************/
3939

@@ -488,9 +488,9 @@ plperl_func_handler(PG_FUNCTION_ARGS)
488488
if (SPI_finish() != SPI_OK_FINISH)
489489
elog(ERROR, "plperl: SPI_finish() failed");
490490

491-
/* XXX is this the approved way to check for an undef result? */
492-
if (perlret == &PL_sv_undef)
491+
if (!(perlret && SvOK(perlret)))
493492
{
493+
/* return NULL if Perl code returned undef */
494494
retval = (Datum) 0;
495495
fcinfo->isnull = true;
496496
}

0 commit comments

Comments
 (0)