mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
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
This commit is contained in:
@ -189,12 +189,12 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem)
|
||||
case SVt_PVHV:
|
||||
return HV_to_JsonbValue((HV *) in, jsonb_state);
|
||||
|
||||
case SVt_NULL:
|
||||
out.type = jbvNull;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (SvUOK(in))
|
||||
if (!SvOK(in))
|
||||
{
|
||||
out.type = jbvNull;
|
||||
}
|
||||
else if (SvUOK(in))
|
||||
{
|
||||
/*
|
||||
* If UV is >=64 bits, we have no better way to make this
|
||||
|
Reference in New Issue
Block a user