Re: Transform for pl/perl
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker )
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Alvaro Herrera <alvherre@2ndquadrant.com>,
Pavel Stehule <pavel.stehule@gmail.com>,
Nikita Glukhov <n.gluhov@postgrespro.ru>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-06-18T18:40:29Z
Lists: pgsql-hackers
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
Commits
-
Fix jsonb_plperl to convert Perl UV values correctly.
- 93b6e03ab479 11.0 landed
-
Fix contrib/hstore_plperl to look through scalar refs.
- e3b7f7cc5063 11.0 landed
- 7594b7a53366 10.5 landed
- 645929c545ef 9.5.14 landed
- 1bebfb9b6365 9.6.10 landed
-
Allow plperl_sv_to_datum to look through scalar refs.
- 3a382983d142 11.0 landed
-
Fix excessive enreferencing in jsonb-to-plperl transform.
- 1731e3741cbb 11.0 landed