pgsql: Fix handling of "undef" in contrib/jsonb_plperl.

Started by Tom Lanealmost 7 years ago1 messagescomitters
Jump to latest
#1Tom Lane
tgl@sss.pgh.pa.us

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: /messages/by-id/1564783533.324795401@f193.i.mail.ru

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e0f5048851ff88a53630a0c121a1cd15f6a2f1cd

Modified Files
--------------
contrib/jsonb_plperl/expected/jsonb_plperl.out | 22 +++++++++++++++++++++-
contrib/jsonb_plperl/expected/jsonb_plperlu.out | 22 +++++++++++++++++++++-
contrib/jsonb_plperl/jsonb_plperl.c | 10 +++++-----
contrib/jsonb_plperl/sql/jsonb_plperl.sql | 13 +++++++++++++
contrib/jsonb_plperl/sql/jsonb_plperlu.sql | 13 +++++++++++++
5 files changed, 73 insertions(+), 7 deletions(-)