]> granicus.if.org Git - postgresql/commit
Fix handling of "undef" in contrib/jsonb_plperl.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 4 Aug 2019 18:05:35 +0000 (14:05 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 4 Aug 2019 18:05:35 +0000 (14:05 -0400)
commitdf521ab79547b82471126e54e9dc7fead4a5a4fb
tree4bb232ee28872dcec9d3f1a2728046b6c0d65092
parent4844c6303296d4fa2c9cc800685e4f404dfa5396
Fix handling of "undef" in contrib/jsonb_plperl.

Perl has multiple internal representations of "undef", and just
testing for SvTYPE(x) == SVt_NULL doesn't recognize all of them,
leading to "cannot transform this Perl type to jsonb" errors.
Use the approved test SvOK() instead.

Report and patch by Ivan Panchenko.  Back-patch to v11 where
this module was added.

Discussion: https://postgr.es/m/1564783533.324795401@f193.i.mail.ru
contrib/jsonb_plperl/expected/jsonb_plperl.out
contrib/jsonb_plperl/expected/jsonb_plperlu.out
contrib/jsonb_plperl/jsonb_plperl.c
contrib/jsonb_plperl/sql/jsonb_plperl.sql
contrib/jsonb_plperl/sql/jsonb_plperlu.sql