aboutsummaryrefslogtreecommitdiff
path: root/src/test/modules/injection_points/expected/injection_points.out
blob: 43bcdd01582f711cc71aa7d799aa96b348ca497e (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
CREATE EXTENSION injection_points;
\getenv libdir PG_LIBDIR
\getenv dlsuffix PG_DLSUFFIX
\set regresslib :libdir '/regress' :dlsuffix
CREATE FUNCTION wait_pid(int)
  RETURNS void
  AS :'regresslib'
  LANGUAGE C STRICT;
-- Non-strict checks
SELECT injection_points_run(NULL);
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_cached(NULL);
 injection_points_cached 
-------------------------
 
(1 row)

SELECT injection_points_attach('TestInjectionBooh', 'booh');
ERROR:  incorrect action "booh" for injection point creation
SELECT injection_points_attach('TestInjectionError', 'error');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_attach('TestInjectionLog', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_attach('TestInjectionLog2', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_run('TestInjectionBooh'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog2'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog2
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog2', NULL); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog2
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog2', 'foobar'); -- notice + arg
NOTICE:  notice triggered for injection point TestInjectionLog2 (foobar)
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionError'); -- error
ERROR:  error triggered for injection point TestInjectionError
SELECT injection_points_run('TestInjectionError', NULL); -- error
ERROR:  error triggered for injection point TestInjectionError
SELECT injection_points_run('TestInjectionError', 'foobar2'); -- error + arg
ERROR:  error triggered for injection point TestInjectionError (foobar2)
-- Re-load cache and run again.
\c
SELECT injection_points_run('TestInjectionLog2'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog2
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionError'); -- error
ERROR:  error triggered for injection point TestInjectionError
-- Remove one entry and check the remaining entries.
SELECT injection_points_detach('TestInjectionError'); -- ok
 injection_points_detach 
-------------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionError'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

-- More entries removed, letting TestInjectionLog2 to check the same
-- callback used in more than one point.
SELECT injection_points_detach('TestInjectionLog'); -- ok
 injection_points_detach 
-------------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionError'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLog2'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog2
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_detach('TestInjectionLog'); -- fails
ERROR:  could not detach injection point "TestInjectionLog"
SELECT injection_points_run('TestInjectionLog2'); -- notice
NOTICE:  notice triggered for injection point TestInjectionLog2
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_detach('TestInjectionLog2');
 injection_points_detach 
-------------------------
 
(1 row)

-- Loading
SELECT injection_points_cached('TestInjectionLogLoad'); -- nothing in cache
 injection_points_cached 
-------------------------
 
(1 row)

SELECT injection_points_load('TestInjectionLogLoad'); -- nothing
 injection_points_load 
-----------------------
 
(1 row)

SELECT injection_points_attach('TestInjectionLogLoad', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_load('TestInjectionLogLoad'); -- nothing happens
 injection_points_load 
-----------------------
 
(1 row)

SELECT injection_points_cached('TestInjectionLogLoad'); -- runs from cache
NOTICE:  notice triggered for injection point TestInjectionLogLoad
 injection_points_cached 
-------------------------
 
(1 row)

SELECT injection_points_cached('TestInjectionLogLoad', NULL); -- runs from cache
NOTICE:  notice triggered for injection point TestInjectionLogLoad
 injection_points_cached 
-------------------------
 
(1 row)

SELECT injection_points_cached('TestInjectionLogLoad', 'foobar'); -- runs from cache
NOTICE:  notice triggered for injection point TestInjectionLogLoad (foobar)
 injection_points_cached 
-------------------------
 
(1 row)

SELECT injection_points_run('TestInjectionLogLoad'); -- runs from cache
NOTICE:  notice triggered for injection point TestInjectionLogLoad
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_detach('TestInjectionLogLoad');
 injection_points_detach 
-------------------------
 
(1 row)

-- Runtime conditions
SELECT injection_points_attach('TestConditionError', 'error');
 injection_points_attach 
-------------------------
 
(1 row)

-- Any follow-up injection point attached will be local to this process.
SELECT injection_points_set_local();
 injection_points_set_local 
----------------------------
 
(1 row)

SELECT injection_points_attach('TestConditionLocal1', 'error');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_attach('TestConditionLocal2', 'notice');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_run('TestConditionLocal1'); -- error
ERROR:  error triggered for injection point TestConditionLocal1
SELECT injection_points_run('TestConditionLocal2'); -- notice
NOTICE:  notice triggered for injection point TestConditionLocal2
 injection_points_run 
----------------------
 
(1 row)

SELECT pg_backend_pid() AS oldpid \gset
-- reload, local injection points should be gone.
\c
-- Wait for the previous backend process to exit, ensuring that its local
-- injection points are cleaned up.
SELECT wait_pid(:'oldpid');
 wait_pid 
----------
 
(1 row)

SELECT injection_points_run('TestConditionLocal1'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestConditionLocal2'); -- nothing
 injection_points_run 
----------------------
 
(1 row)

SELECT injection_points_run('TestConditionError'); -- error
ERROR:  error triggered for injection point TestConditionError
SELECT injection_points_detach('TestConditionError');
 injection_points_detach 
-------------------------
 
(1 row)

-- Attaching injection points that use the same name as one defined locally
-- previously should work.
SELECT injection_points_attach('TestConditionLocal1', 'error');
 injection_points_attach 
-------------------------
 
(1 row)

SELECT injection_points_detach('TestConditionLocal1');
 injection_points_detach 
-------------------------
 
(1 row)

DROP EXTENSION injection_points;
DROP FUNCTION wait_pid;