mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Fix contrib/hstore_plperl to look through scalar refs.
Bring this transform function into sync with the policy established
by commit 3a382983d
.
Also, fix it to make sure that what it drills down to is indeed a
hash, and not some other kind of Perl SV. Previously, the test
cases added here provoked crashes.
Because of the crash hazard, back-patch to 9.5 where this module
was introduced.
Discussion: https://postgr.es/m/28336.1528393969@sss.pgh.pa.us
This commit is contained in:
@ -31,6 +31,25 @@ $$;
|
||||
|
||||
SELECT test2arr();
|
||||
|
||||
-- check error cases
|
||||
CREATE OR REPLACE FUNCTION test2() RETURNS hstore
|
||||
LANGUAGE plperl
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
return 42;
|
||||
$$;
|
||||
|
||||
SELECT test2();
|
||||
|
||||
CREATE OR REPLACE FUNCTION test2() RETURNS hstore
|
||||
LANGUAGE plperl
|
||||
TRANSFORM FOR TYPE hstore
|
||||
AS $$
|
||||
return [1, 2];
|
||||
$$;
|
||||
|
||||
SELECT test2();
|
||||
|
||||
|
||||
DROP FUNCTION test2();
|
||||
DROP FUNCTION test2arr();
|
||||
|
Reference in New Issue
Block a user