pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: ilmari@ilmari.org
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
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: Mon, 09 Apr 2018 14:00:55 +0100
Message-ID: <d8jtvskjzzs.fsf@dalvik.ping.uio.no> (raw )
In-Reply-To: <26a0840a-6b09-44fc-9e4e-8200c1887882@2ndquadrant.com >
References: <20171127132439.23dc26ef@anthony-24-g082ur >
<20171201184921.27he6vbp62yegpvm@alvherre.pgsql >
<20171207125455.39067aa7@anthony-24-g082ur >
<20171207125602.5326f103@anthony-24-g082ur >
<CAEepm=02=Ya7p=-X5Of=JD-+9+bmmwnpd9nr8AeVnOopB6Y+NQ@mail.gmail.com >
<20180112114739.6a9f0d4c@anthony-24-g082ur >
<20180131103621.GA19345@zakirov.localdomain >
<20180215125313.290468ae@anthony-24-g082ur >
<CAFj8pRCYBPFGZG5LHdfY1Ej+a_9sb3ugyDkUaJGD37UjpRpA8Q@mail.gmail.com >
<20180312110821.29c80420@anthony-24-g082ur >
<CAFj8pRDaTYHD30CP8u2v_wwsJfxFBfthcNEp_KgEOHVN0gUfAw@mail.gmail.com >
<505345c5-0159-077d-f64e-60afb01e5fbe@postgrespro.ru >
<CAFj8pRB1mLEvmnhRL9HheF6yeKPvuzBf2tQ=s+2QXGpnCJdbqQ@mail.gmail.com >
<26a0840a-6b09-44fc-9e4e-8200c1887882@2ndquadrant.com >
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 3/15/18 03:46, Pavel Stehule wrote:
>> It looks well
>>
>> the patch has tests and doc,
>> there are not any warnings or compilation issues
>> all tests passed
>>
>> I'll mark this patch as ready for commiter
>
> committed
I played around with this a bit, and noticed that the number handling
doesn't cope with Perl UVs (unsigned integers) in the (IV_MAX, UV_MAX]
range:
ilmari@[local]:5432 ~=# CREATE FUNCTION testUVToJsonb() RETURNS jsonb
ilmari@[local]:5432 ~-# LANGUAGE plperl TRANSFORM FOR TYPE jsonb
ilmari@[local]:5432 ~-# as $$
ilmari@[local]:5432 ~$# $val = ~0;
ilmari@[local]:5432 ~$# elog(NOTICE, "value is $val");
ilmari@[local]:5432 ~$# return $val;
ilmari@[local]:5432 ~$# $$;
CREATE FUNCTION
Time: 6.795 ms
ilmari@[local]:5432 ~=# select testUVToJsonb();
NOTICE: value is 18446744073709551615
┌───────────────┐
│ testuvtojsonb │
├───────────────┤
│ -1 │
└───────────────┘
(1 row)
I tried fixing this by adding an 'if (SvUV(in))' clause to
SV_to_JsonbValue, but I couldn't find a function to create a numeric
value from an uint64. If it's not possible, should we error on UVs
greater than PG_INT64_MAX?
- ilmari
--
"The surreality of the universe tends towards a maximum" -- Skud's Law
"Never formulate a law or axiom that you're not prepared to live with
the consequences of." -- Skud's Meta-Law
view thread (62+ messages) latest in thread
Message-ID: <d8jtvskjzzs.fsf@dalvik.ping.uio.no>
Permalink: ../d8jtvskjzzs.fsf@dalvik.ping.uio.no/
Also on: postgresql.org/message-id/d8jtvskjzzs.fsf@dalvik.ping.uio.no
copy link · copy postgr.es
reply 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: ilmari@ilmari.org, peter.eisentraut@2ndquadrant.com, pavel.stehule@gmail.com, n.gluhov@postgrespro.ru, pgsql-hackers@lists.postgresql.org
Subject: Re: Transform for pl/perl
In-Reply-To: <d8jtvskjzzs.fsf@dalvik.ping.uio.no>
* 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