summaryrefslogtreecommitdiffstats
path: root/src/pl/plperl/sql/plperl_init.sql
blob: 2aa381103340e8ecd018f284490378efeefe73a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
-- test plperl.on_plperl_init

-- This test tests setting on_plperl_init after loading plperl
LOAD 'plperl';

SET SESSION plperl.on_plperl_init = ' system("/nonesuch"); ';

SHOW plperl.on_plperl_init;

DO $$ warn 42 $$ language plperl;

--
-- Reconnect (to unload plperl), then test setting on_plperl_init
-- as an unprivileged user
--

\c -

CREATE ROLE regress_plperl_user;

SET ROLE regress_plperl_user;

-- this succeeds, since the GUC isn't known yet
SET SESSION plperl.on_plperl_init = 'test';

RESET ROLE;

LOAD 'plperl';

SHOW plperl.on_plperl_init;

DO $$ warn 42 $$ language plperl;

-- now we won't be allowed to set it in the first place
SET ROLE regress_plperl_user;

SET SESSION plperl.on_plperl_init = 'test';

RESET ROLE;

DROP ROLE regress_plperl_user;