From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Nikita Glukhov <n.gluhov@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Transform for pl/perl
Date: Wed, 6 Jun 2018 15:46:52 -0400
Message-ID: <e5130c85-23da-5d11-ca74-6a050cc5fa85@2ndquadrant.com> (raw)
In-Reply-To: <20180606161453.tvp4ltavlcvejmmz@alvherre.pgsql>
References: <20180606161453.tvp4ltavlcvejmmz@alvherre.pgsql>
On 6/6/18 12:14, Alvaro Herrera wrote:
> On 2018-May-17, Peter Eisentraut wrote:
>
>> The items that are still open from the original email are:
>>
>> 2) jsonb scalar values are passed to the plperl function wrapped in not
>> one, but _two_ layers of references
>>
>> 3) jsonb numeric values are passed as perl's NV (floating point) type,
>> losing precision if they're integers that would fit in an IV or UV.
>>
>> #2 appears to be a quality of implementation issue without any
>> user-visible effects.
>>
>> #3 is an opportunity for future improvement, but works as intended right
>> now.
>>
>> I think patches for these issues could still be considered during beta,
>> but they are not release blockers IMO.
>
> It appears to me that item #2 definitely would need to be fixed before
> release, so that it doesn't become a backwards-incompatibility later on.
The way I understand it, it's only how things are passed around
internally. Nothing is noticeable externally, and so there is no
backward compatibility issue.
At least that's how I understand it. So far this is only a claim by one
person. I haven't seen anything conclusive about whether there is an
actual issue.
> I'm not sure I agree that #3 is just a future feature. If you have
> functions working with jsonb numeric giving exact results, and later
> enable transforms for plperl, then your function starts giving inexact
> results? Maybe I misunderstand the issue but this doesn't sound great.
It would be the other way around. Right now, a transform from jsonb to
Perl would produce a float value in Perl. The argument is that it could
be an integer value in Perl if the original value fits. That's a change
worth considering, but the current behavior is consistent and works as
designed.
I took a brief look at this, and it seems there are some APIs needed to
be exposed from numeric.c to know whether a numeric is an integer.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: peter.eisentraut@2ndquadrant.com, alvherre@2ndquadrant.com, ilmari@ilmari.org, tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Transform for pl/perl
In-Reply-To: <e5130c85-23da-5d11-ca74-6a050cc5fa85@2ndquadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox