1 -- test plperl.on_plperl_init via the shared hash
2 -- (must be done before plperl is first used)
4 -- This test tests setting on_plperl_init before loading plperl
6 -- testing on_plperl_init gets run, and that it can alter %_SHARED
7 SET plperl.on_plperl_init = '$_SHARED{on_init} = 42';
9 -- test the shared hash
11 create function setme(key text, val text) returns void language plperl as $$
19 create function getme(key text) returns text language plperl as $$
22 return $_SHARED{$key};
26 select setme('ourkey','ourval');
28 select getme('ourkey');
30 select getme('on_init');
32 -- verify that we can use $_SHARED in strict mode
33 create or replace function perl_shared() returns int as $$
35 my $val = $_SHARED{'stuff'};
36 $_SHARED{'stuff'} = '1';