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 1fUz56-0002zP-T4 for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 18:40:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fUz55-0001ta-Bz for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 18:40:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUz55-0001tR-14 for pgsql-hackers@lists.postgresql.org; Mon, 18 Jun 2018 18:40:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUz52-00014r-CV for pgsql-hackers@lists.postgresql.org; Mon, 18 Jun 2018 18:40:45 +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 w5IIeT7p002942; Mon, 18 Jun 2018 14:40:29 -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: References: <20180606161453.tvp4ltavlcvejmmz@alvherre.pgsql> Comments: In-reply-to ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) message dated "Thu, 07 Jun 2018 14:54:10 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2940.1529347229.1@sss.pgh.pa.us> Date: Mon, 18 Jun 2018 14:40:29 -0400 Message-ID: <2941.1529347229@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes: > [ 0001-Fix-excess-enreferencing-in-plperl-jsonb-transform.patch ] I tested this a bit more thoroughly by dint of applying Data::Dumper to the Perl values, and found that we were still getting extra references to sub-objects, for example INFO: $VAR1 = {'1' => \{'2' => \['3','4','5']},'2' => '3'}; where what we want is INFO: $VAR1 = {'1' => {'2' => ['3','4','5']},'2' => '3'}; That turns out to be because the newRV() call in JsonbValue_to_SV() is also superfluous, if we've set up refs around HV and AV scalars. Pushed with that change and the extra testing technology. I'll go push the dereferencing patch I proposed shortly, as well. 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. I'm inclined to reject that proposal, though, and not just because we don't have a patch for it. What's bothering me about it is that then the behavior would be dependent on the width of IV in the particular Perl installation. I think that is a platform dependency we can do without. regards, tom lane