Re: BUG #3415: plperl spi_exec_prepared variable undef value confusion - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #3415: plperl spi_exec_prepared variable undef value confusion
Date
Msg-id 14451.1183049184@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #3415: plperl spi_exec_prepared variable undef value confusion  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
I wrote:
> [ pokes at it ... ]  Some of the places in plperl.c that are checking for
> undef values use code like

>     if (SvOK(val) && SvTYPE(val) != SVt_NULL)

> and some just test the SvTYPE part.  It looks to me like the SvOK test
> is essential --- in fact I'm not sure the SvTYPE test is even bringing
> anything to the party.  Any perl-extension gurus around here?

Google turned up this comp.lang.perl.misc thread:
http://www.dbforums.com/showthread.php?s=6aaf30de92e7732ff45d667075f997bf&t=1071763
which seems to establish pretty conclusively that SvOK() is *the* way
to check for defined-ness, and the SVt_NULL test is wrong as well as
useless.  So barring objections, I'll go make the code do it that way.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #3415: plperl spi_exec_prepared variable undef value confusion
Next
From: Stephen Frost
Date:
Subject: 'SET LOCAL ROLE blah;' doesn't work?