mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Fix jsonb_plperl to convert Perl UV values correctly.
Values greater than IV_MAX were incorrectly converted to SQL, for instance ~0 would become -1 rather than 18446744073709551615 (on a 64-bit machine). Dagfinn Ilmari Mannsåker, adjusted a bit by me Discussion: https://postgr.es/m/d8jtvskjzzs.fsf@dalvik.ping.uio.no
This commit is contained in:
@ -34,6 +34,18 @@ $$;
|
||||
SELECT testSVToJsonb();
|
||||
|
||||
|
||||
CREATE FUNCTION testUVToJsonb() RETURNS jsonb
|
||||
LANGUAGE plperl
|
||||
TRANSFORM FOR TYPE jsonb
|
||||
as $$
|
||||
$val = ~0;
|
||||
return $val;
|
||||
$$;
|
||||
|
||||
-- this might produce either 18446744073709551615 or 4294967295
|
||||
SELECT testUVToJsonb() IN ('18446744073709551615'::jsonb, '4294967295'::jsonb);
|
||||
|
||||
|
||||
-- this revealed a bug in the original implementation
|
||||
CREATE FUNCTION testRegexpResultToJsonb() RETURNS jsonb
|
||||
LANGUAGE plperl
|
||||
|
Reference in New Issue
Block a user