blob: 02497d9e02bea1b865b35d148c6750a2f7649d0f (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
-- test warnings and errors from plperl
create or replace function perl_elog(text) returns void language plperl as $$
my $msg = shift;
elog(NOTICE,$msg);
$$;
select perl_elog('explicit elog');
NOTICE: explicit elog
CONTEXT: PL/Perl function "perl_elog"
perl_elog
-----------
(1 row)
create or replace function perl_warn(text) returns void language plperl as $$
my $msg = shift;
warn($msg);
$$;
select perl_warn('implicit elog via warn');
WARNING: implicit elog via warn at line 4.
CONTEXT: PL/Perl function "perl_warn"
perl_warn
-----------
(1 row)
-- test strict mode on/off
SET plperl.use_strict = true;
create or replace function uses_global() returns text language plperl as $$
$global = 1;
$other_global = 2;
return 'uses_global worked';
$$;
ERROR: Global symbol "$global" requires explicit package name at line 3.
Global symbol "$other_global" requires explicit package name at line 4.
CONTEXT: compilation of PL/Perl function "uses_global"
select uses_global();
ERROR: function uses_global() does not exist
LINE 1: select uses_global();
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SET plperl.use_strict = false;
create or replace function uses_global() returns text language plperl as $$
$global = 1;
$other_global=2;
return 'uses_global worked';
$$;
select uses_global();
uses_global
--------------------
uses_global worked
(1 row)
|