Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5WPy-0003Z7-KA for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Apr 2018 13:01:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f5WPx-0005Q0-8z for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Apr 2018 13:01:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f5WPx-0005Pr-1u for pgsql-hackers@lists.postgresql.org; Mon, 09 Apr 2018 13:01:05 +0000 Received: from ping.uio.no ([2001:700:100:570::196]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1f5WPu-0003tv-3z for pgsql-hackers@lists.postgresql.org; Mon, 09 Apr 2018 13:01:04 +0000 Received: from [2001:700:100:570::211] (helo=dalvik.ping.uio.no ident=Debian-exim) by ping.uio.no with esmtp (Exim 4.72 #1 (Debian)) id 1f5WPo-00063Z-8J; Mon, 09 Apr 2018 15:00:58 +0200 Received: from ilmari by dalvik.ping.uio.no with local (Exim 4.84_2) (envelope-from ) id 1f5WPn-0002m6-VD; Mon, 09 Apr 2018 15:00:56 +0200 From: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) To: Peter Eisentraut Cc: Pavel Stehule , Nikita Glukhov , PostgreSQL Hackers Subject: Re: Transform for pl/perl References: <20171127132439.23dc26ef@anthony-24-g082ur> <20171201184921.27he6vbp62yegpvm@alvherre.pgsql> <20171207125455.39067aa7@anthony-24-g082ur> <20171207125602.5326f103@anthony-24-g082ur> <20180112114739.6a9f0d4c@anthony-24-g082ur> <20180131103621.GA19345@zakirov.localdomain> <20180215125313.290468ae@anthony-24-g082ur> <20180312110821.29c80420@anthony-24-g082ur> <505345c5-0159-077d-f64e-60afb01e5fbe@postgrespro.ru> <26a0840a-6b09-44fc-9e4e-8200c1887882@2ndquadrant.com> Mail-Copies-To: nobody Date: Mon, 09 Apr 2018 14:00:55 +0100 In-Reply-To: <26a0840a-6b09-44fc-9e4e-8200c1887882@2ndquadrant.com> (Peter Eisentraut's message of "Tue, 3 Apr 2018 09:58:55 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Exiscan-Spam-Score: -3.7 (---) X-Exiscan-Spam-Report: SpamAssassin 3.3.1 (2010-03-16) on pike.ping.uio.no Score Rule * -5.0 PING_UIO_MAIL_IS_INTERNAL Message has never been outside * 129.240.0.0/16 or 193.157.115.0/24 * 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut 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