Re: Transform for pl/perl
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
From: ilmari@ilmari.org (Dagfinn Ilmari Mannsåker )
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>,
Pavel Stehule <pavel.stehule@gmail.com>,
Nikita Glukhov <n.gluhov@postgrespro.ru>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-09T15:02:23Z
Lists: pgsql-hackers
Attachments
Tom Lane <tgl@sss.pgh.pa.us> writes: > ilmari@ilmari.org (Dagfinn Ilmari =?utf-8?Q?Manns=C3=A5ker?=) writes: >> 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? > > I think you'd have to convert to text and back. That's kind of icky, > but it beats failing. I had a look, and that's what the PL/Python transform does. Attached is a patch that does that for PL/Perl too, but only if the value is actually > PG_INT64_MAX. The secondary output files are for Perls with 32bit IV/UV types, but I haven't been able to test them, since Debian's Perl uses 64bit integers even on 32bit platforms. > Or we could add a not-visible-to-SQL uint8-to-numeric function in > numeric.c. Not sure if this is enough use-case to justify that > though. I don't think this one use-case is enough, but it's worth keeping in mind if it keeps cropping up. - ilmari -- "I use RMS as a guide in the same way that a boat captain would use a lighthouse. It's good to know where it is, but you generally don't want to find yourself in the same spot." - Tollef Fog Heen
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