summaryrefslogtreecommitdiffstats
path: root/src/test/modules/plsample/expected/plsample.out
blob: 8ad5f7af14c9615a13be33d21ecf0525a2d687d4 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
CREATE EXTENSION plsample;
-- Create and test some dummy functions
CREATE FUNCTION plsample_result_text(a1 numeric, a2 text, a3 integer[])
RETURNS TEXT
AS $$
  Example of source with text result.
$$ LANGUAGE plsample;
SELECT plsample_result_text(1.23, 'abc', '{4, 5, 6}');
NOTICE:  source text of function "plsample_result_text": 
  Example of source with text result.

NOTICE:  argument: 0; name: a1; value: 1.23
NOTICE:  argument: 1; name: a2; value: abc
NOTICE:  argument: 2; name: a3; value: {4,5,6}
         plsample_result_text          
---------------------------------------
                                      +
   Example of source with text result.+
 
(1 row)

CREATE FUNCTION plsample_result_void(a1 text[])
RETURNS VOID
AS $$
  Example of source with void result.
$$ LANGUAGE plsample;
SELECT plsample_result_void('{foo, bar, hoge}');
NOTICE:  source text of function "plsample_result_void": 
  Example of source with void result.

NOTICE:  argument: 0; name: a1; value: {foo,bar,hoge}
 plsample_result_void 
----------------------
 
(1 row)

CREATE FUNCTION my_trigger_func() RETURNS trigger AS $$
if TD_event == "INSERT"
    return TD_NEW
elseif TD_event == "UPDATE"
    return TD_NEW
else
    return "OK"
end
$$ language plsample;
CREATE TABLE my_table (num integer, description text);
CREATE TRIGGER my_trigger_func BEFORE INSERT OR UPDATE ON my_table
       FOR EACH ROW EXECUTE FUNCTION my_trigger_func();
CREATE TRIGGER my_trigger_func2 AFTER INSERT OR UPDATE ON my_table
       FOR EACH ROW EXECUTE FUNCTION my_trigger_func(8);
INSERT INTO my_table (num, description)
VALUES (1, 'first');
NOTICE:  source text of function "my_trigger_func": 
if TD_event == "INSERT"
    return TD_NEW
elseif TD_event == "UPDATE"
    return TD_NEW
else
    return "OK"
end

NOTICE:  trigger name: my_trigger_func
NOTICE:  trigger relation: my_table
NOTICE:  trigger relation schema: public
NOTICE:  triggered by INSERT
NOTICE:  triggered BEFORE
NOTICE:  triggered per row
NOTICE:  source text of function "my_trigger_func": 
if TD_event == "INSERT"
    return TD_NEW
elseif TD_event == "UPDATE"
    return TD_NEW
else
    return "OK"
end

NOTICE:  trigger name: my_trigger_func2
NOTICE:  trigger relation: my_table
NOTICE:  trigger relation schema: public
NOTICE:  triggered by INSERT
NOTICE:  triggered AFTER
NOTICE:  triggered per row
NOTICE:  trigger arg[0]: 8
UPDATE my_table
SET description = 'first, modified once'
WHERE num = 1;
NOTICE:  source text of function "my_trigger_func": 
if TD_event == "INSERT"
    return TD_NEW
elseif TD_event == "UPDATE"
    return TD_NEW
else
    return "OK"
end

NOTICE:  trigger name: my_trigger_func
NOTICE:  trigger relation: my_table
NOTICE:  trigger relation schema: public
NOTICE:  triggered by UPDATE
NOTICE:  triggered BEFORE
NOTICE:  triggered per row
NOTICE:  source text of function "my_trigger_func": 
if TD_event == "INSERT"
    return TD_NEW
elseif TD_event == "UPDATE"
    return TD_NEW
else
    return "OK"
end

NOTICE:  trigger name: my_trigger_func2
NOTICE:  trigger relation: my_table
NOTICE:  trigger relation schema: public
NOTICE:  triggered by UPDATE
NOTICE:  triggered AFTER
NOTICE:  triggered per row
NOTICE:  trigger arg[0]: 8