Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fV20d-0002rV-Gj for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 21:48:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fV20c-0006S9-9H for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 21:48:22 +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 1fV20c-0006S0-2Q for pgsql-hackers@lists.postgresql.org; Mon, 18 Jun 2018 21:48:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fV20Z-0006Yy-1s for pgsql-hackers@lists.postgresql.org; Mon, 18 Jun 2018 21:48:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5ILm5i8029397; Mon, 18 Jun 2018 17:48:05 -0400 From: Tom Lane To: ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) cc: Peter Eisentraut , Alvaro Herrera , Pavel Stehule , Nikita Glukhov , PostgreSQL Hackers Subject: Re: Transform for pl/perl In-reply-to: <2941.1529347229@sss.pgh.pa.us> References: <20180606161453.tvp4ltavlcvejmmz@alvherre.pgsql> <2941.1529347229@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 18 Jun 2018 14:40:29 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29395.1529358485.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 18 Jun 2018 17:48:05 -0400 Message-ID: <29396.1529358485@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I wrote: > The remaining unresolved issue in this thread is Ilmari's suggestion > that we should convert integers to Perl IV (or UV?) if they fit, rather > than always convert to NV as now. Oh ... after re-reading the thread I realized there was one other point that we'd all forgotten about, namely the business about ~0 getting converted to -1 rather than what Perl interprets it as. Ilmari sent in a patch for that, against which I'd raised two complaints: 1. Possible compiler complaints about a constant-false comparison, on machines where type UV is 32 bits. 2. Need for secondary expected-output files, which'd be a pain to maintain. I realized that point 1 could be dealt with just by not trying to be smart, but always using the convert-to-text code path. Given that it seems to be hard to produce a UV value in Perl, I doubt it is worth working any harder than that. Also, point 2 could be dealt with in this perhaps crude way: -- this might produce either 18446744073709551615 or 4294967295 SELECT testUVToJsonb() IN ('18446744073709551615'::jsonb, '4294967295'::js= onb); Pushed with those adjustments. regards, tom lane