2 -- Install the plperl and plperlu extensions
5 -- Before going ahead with the to-be-tested installations, verify that
6 -- a non-superuser is allowed to install plperl (but not plperlu) when
7 -- suitable permissions have been granted.
9 CREATE USER regress_plperl_user1;
10 CREATE USER regress_plperl_user2;
12 SET ROLE regress_plperl_user1;
14 CREATE EXTENSION plperl; -- fail
15 CREATE EXTENSION plperlu; -- fail
21 execute format('grant create on database %I to regress_plperl_user1',
26 SET ROLE regress_plperl_user1;
28 CREATE EXTENSION plperl;
29 CREATE EXTENSION plperlu; -- fail
30 CREATE SCHEMA plperl_setup_scratch;
31 SET search_path = plperl_setup_scratch;
32 GRANT ALL ON SCHEMA plperl_setup_scratch TO regress_plperl_user2;
34 CREATE FUNCTION foo1() returns int language plperl as '1;';
37 -- Must reconnect to avoid failure with non-MULTIPLICITY Perl interpreters
39 SET search_path = plperl_setup_scratch;
41 SET ROLE regress_plperl_user1;
43 -- Should be able to change privileges on the language
44 revoke all on language plperl from public;
46 SET ROLE regress_plperl_user2;
48 CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
50 SET ROLE regress_plperl_user1;
52 grant usage on language plperl to regress_plperl_user2;
54 SET ROLE regress_plperl_user2;
56 CREATE FUNCTION foo2() returns int language plperl as '2;';
59 SET ROLE regress_plperl_user1;
61 -- Should be able to drop the extension, but not the language per se
62 DROP LANGUAGE plperl CASCADE;
63 DROP EXTENSION plperl CASCADE;
67 DROP OWNED BY regress_plperl_user1;
68 DROP USER regress_plperl_user1;
69 DROP USER regress_plperl_user2;
71 -- Now install the versions that will be used by subsequent test scripts.
72 CREATE EXTENSION plperl;
73 CREATE EXTENSION plperlu;