Re: Transform for pl/perl

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Anthony Bykov <a(dot)bykov(at)postgrespro(dot)ru>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Transform for pl/perl
Date: 2018-01-13 14:29:46
Message-ID: ad3319e7-39f9-f860-0167-529baf0c955b@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01/12/2018 03:47 AM, Anthony Bykov wrote:
>
> The problem was that different perl compilers uses different infinity
> representations. Some of them use "Inf" others - use "inf". So, in
> attachments there is a new version of the patch.
>

There's a bit of an impedance mismatch and inconsistency here. I think
we need to deal with json scalars (particularly numerics) the same way
we do for plain scalar arguments. We don't convert a numeric argument to
and SvNV. We just do this in plperl_call_perl_func():

                tmp = OutputFunctionCall(&(desc->arg_out_func[i]),
                                         fcinfo->arg[i]);
                sv = cstr2sv(tmp);
                pfree(tmp)
[...]

            PUSHs(sv_2mortal(sv));

Large numerics won't work as SvNV values, which have to fit in a
standard double. So I think we should treat them the same way we do for
plain scalar arguments.

(This also suggests that the tests are a bit deficient in not testing
jsonb with large numeric values.)

I'm going to set this back to waiting on author pending discussion.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Arthur Zakirov 2018-01-13 15:22:41 Re: [PROPOSAL] Shared Ispell dictionaries
Previous Message Rader, David 2018-01-13 14:27:01 Re: [PATCH] ECPG bug fix in preproc when indicator struct is shorter than record struct