2 -- Install the plperl and plperlu extensions
4 -- Before going ahead with the to-be-tested installations, verify that
5 -- a non-superuser is allowed to install plperl (but not plperlu) when
6 -- suitable permissions have been granted.
7 CREATE USER regress_user1;
8 CREATE USER regress_user2;
9 SET ROLE regress_user1;
10 CREATE EXTENSION plperl; -- fail
11 ERROR: permission denied to create extension "plperl"
12 HINT: Must have CREATE privilege on current database to create this extension.
13 CREATE EXTENSION plperlu; -- fail
14 ERROR: permission denied to create extension "plperlu"
15 HINT: Must be superuser to create this extension.
19 execute format('grant create on database %I to regress_user1',
23 SET ROLE regress_user1;
24 CREATE EXTENSION plperl;
25 CREATE EXTENSION plperlu; -- fail
26 ERROR: permission denied to create extension "plperlu"
27 HINT: Must be superuser to create this extension.
28 CREATE FUNCTION foo1() returns int language plperl as '1;';
35 -- Must reconnect to avoid failure with non-MULTIPLICITY Perl interpreters
37 SET ROLE regress_user1;
38 -- Should be able to change privileges on the language
39 revoke all on language plperl from public;
40 SET ROLE regress_user2;
41 CREATE FUNCTION foo2() returns int language plperl as '2;'; -- fail
42 ERROR: permission denied for language plperl
43 SET ROLE regress_user1;
44 grant usage on language plperl to regress_user2;
45 SET ROLE regress_user2;
46 CREATE FUNCTION foo2() returns int language plperl as '2;';
53 SET ROLE regress_user1;
54 -- Should be able to drop the extension, but not the language per se
55 DROP LANGUAGE plperl CASCADE;
56 ERROR: cannot drop language plperl because extension plperl requires it
57 HINT: You can drop extension plperl instead.
58 DROP EXTENSION plperl CASCADE;
59 NOTICE: drop cascades to 2 other objects
60 DETAIL: drop cascades to function foo1()
61 drop cascades to function foo2()
64 DROP OWNED BY regress_user1;
65 DROP USER regress_user1;
66 DROP USER regress_user2;
67 -- Now install the versions that will be used by subsequent test scripts.
68 CREATE EXTENSION plperl;
69 CREATE EXTENSION plperlu;