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