Re[2]: jsonb_plperl bug

Поиск
Список
Период
Сортировка
От Ivan Panchenko
Тема Re[2]: jsonb_plperl bug
Дата
Msg-id 1564815812.697452305@f521.i.mail.ru
обсуждение исходный текст
Ответ на Re: jsonb_plperl bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Re[2]: jsonb_plperl bug  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers


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

Ivan Panchenko <wao@mail.ru> writes:
> I have found a bug in jsonb_plperl extension. A possible fix is proposed below.
> ...
> + /* SVt_PV without POK flag is also NULL */
> + if(SvTYPE(in) == SVt_PV)

Ugh. Doesn't Perl provide some saner way to determine the type of a SV?

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.

SvOK() check before the switch seems too early, because in such case we would  loose hashes and arrays which are not SvOK. So I put it inside the switch. May be, it's better to remove the switch at all, and rewrite the code with ifs?


(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.

regards, tom lane
Regards, Ivan





Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Konstantin Knizhnik
Дата:
Сообщение: Re: pglz performance
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pgbench - implement strict TPC-B benchmark