Re: Re[2]: jsonb_plperl bug

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ivan Panchenko <wao@mail.ru>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2019-08-04T18:08:39Z
Lists: pgsql-hackers
=?UTF-8?B?SXZhbiBQYW5jaGVua28=?= <wao@mail.ru> writes:
> Tom Lane <tgl@sss.pgh.pa.us>:
>> The core code seems to think that SvOK() is a sufficient test for an
>> undef.  Should we be doing that before the switch, perhaps? 

> Thank you, Tom. Yes, there is a solution with SvOK(), please see the attached patch.

Yeah, that looks cleaner.  I suppose we could get rid of the switch()
but it would result in a bigger diff for not much reason.

>> (My underlying concern here is mostly about whether we have other
>> similar bugs.  There are a lot of places checking SvTYPE.) 

> I looked through plperl.c, but found no similar cases of checking SvTYPE.

Yeah, at least there are no other places explicitly checking for
SVt_NULL.

Pushed with minor fiddling with the test case.  Thanks!

			regards, tom lane



Commits

  1. Fix handling of "undef" in contrib/jsonb_plperl.