1 -- test old extension version entry points
2 CREATE EXTENSION pg_stat_statements WITH VERSION '1.4';
3 -- Execution of pg_stat_statements_reset() is granted only to
4 -- superusers in 1.4, so this fails.
5 SET SESSION AUTHORIZATION pg_read_all_stats;
6 SELECT pg_stat_statements_reset();
7 ERROR: permission denied for function pg_stat_statements_reset
8 RESET SESSION AUTHORIZATION;
9 AlTER EXTENSION pg_stat_statements UPDATE TO '1.5';
10 -- Execution of pg_stat_statements_reset() should be granted to
11 -- pg_read_all_stats now, so this works.
12 SET SESSION AUTHORIZATION pg_read_all_stats;
13 SELECT pg_stat_statements_reset();
14 pg_stat_statements_reset
15 --------------------------
19 RESET SESSION AUTHORIZATION;
20 -- In 1.6, it got restricted back to superusers.
21 AlTER EXTENSION pg_stat_statements UPDATE TO '1.6';
22 SET SESSION AUTHORIZATION pg_read_all_stats;
23 SELECT pg_stat_statements_reset();
24 ERROR: permission denied for function pg_stat_statements_reset
25 RESET SESSION AUTHORIZATION;
26 SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc);
28 -------------------------------------------------------------------------------
29 CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset() +
33 AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset$function$+
37 -- New function for pg_stat_statements_reset introduced, still
38 -- restricted for non-superusers.
39 AlTER EXTENSION pg_stat_statements UPDATE TO '1.7';
40 SET SESSION AUTHORIZATION pg_read_all_stats;
41 SELECT pg_stat_statements_reset();
42 ERROR: permission denied for function pg_stat_statements_reset
43 RESET SESSION AUTHORIZATION;
44 SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc);
46 --------------------------------------------------------------------------------------------------------------------------------
47 CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0)+
50 PARALLEL SAFE STRICT +
51 AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_7$function$ +
55 SELECT pg_stat_statements_reset();
56 pg_stat_statements_reset
57 --------------------------
62 View "public.pg_stat_statements"
63 Column | Type | Collation | Nullable | Default
64 ---------------------+------------------+-----------+----------+---------
67 queryid | bigint | | |
70 total_time | double precision | | |
71 min_time | double precision | | |
72 max_time | double precision | | |
73 mean_time | double precision | | |
74 stddev_time | double precision | | |
76 shared_blks_hit | bigint | | |
77 shared_blks_read | bigint | | |
78 shared_blks_dirtied | bigint | | |
79 shared_blks_written | bigint | | |
80 local_blks_hit | bigint | | |
81 local_blks_read | bigint | | |
82 local_blks_dirtied | bigint | | |
83 local_blks_written | bigint | | |
84 temp_blks_read | bigint | | |
85 temp_blks_written | bigint | | |
86 blk_read_time | double precision | | |
87 blk_write_time | double precision | | |
89 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
95 -- New functions and views for pg_stat_statements in 1.8
96 AlTER EXTENSION pg_stat_statements UPDATE TO '1.8';
97 SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc);
99 --------------------------------------------------------------------------------------------------------------------------------
100 CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0)+
103 PARALLEL SAFE STRICT +
104 AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_7$function$ +
108 \d pg_stat_statements
109 View "public.pg_stat_statements"
110 Column | Type | Collation | Nullable | Default
111 ---------------------+------------------+-----------+----------+---------
114 queryid | bigint | | |
117 total_plan_time | double precision | | |
118 min_plan_time | double precision | | |
119 max_plan_time | double precision | | |
120 mean_plan_time | double precision | | |
121 stddev_plan_time | double precision | | |
123 total_exec_time | double precision | | |
124 min_exec_time | double precision | | |
125 max_exec_time | double precision | | |
126 mean_exec_time | double precision | | |
127 stddev_exec_time | double precision | | |
129 shared_blks_hit | bigint | | |
130 shared_blks_read | bigint | | |
131 shared_blks_dirtied | bigint | | |
132 shared_blks_written | bigint | | |
133 local_blks_hit | bigint | | |
134 local_blks_read | bigint | | |
135 local_blks_dirtied | bigint | | |
136 local_blks_written | bigint | | |
137 temp_blks_read | bigint | | |
138 temp_blks_written | bigint | | |
139 blk_read_time | double precision | | |
140 blk_write_time | double precision | | |
141 wal_records | bigint | | |
142 wal_fpi | bigint | | |
143 wal_bytes | numeric | | |
145 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
151 -- New function pg_stat_statement_info, and new function
152 -- and view for pg_stat_statements introduced in 1.9
153 AlTER EXTENSION pg_stat_statements UPDATE TO '1.9';
154 SELECT pg_get_functiondef('pg_stat_statements_info'::regproc);
156 -------------------------------------------------------------------------------------------------------------------------
157 CREATE OR REPLACE FUNCTION public.pg_stat_statements_info(OUT dealloc bigint, OUT stats_reset timestamp with time zone)+
160 PARALLEL SAFE STRICT +
161 AS '$libdir/pg_stat_statements', $function$pg_stat_statements_info$function$ +
165 \d pg_stat_statements
166 View "public.pg_stat_statements"
167 Column | Type | Collation | Nullable | Default
168 ---------------------+------------------+-----------+----------+---------
171 toplevel | boolean | | |
172 queryid | bigint | | |
175 total_plan_time | double precision | | |
176 min_plan_time | double precision | | |
177 max_plan_time | double precision | | |
178 mean_plan_time | double precision | | |
179 stddev_plan_time | double precision | | |
181 total_exec_time | double precision | | |
182 min_exec_time | double precision | | |
183 max_exec_time | double precision | | |
184 mean_exec_time | double precision | | |
185 stddev_exec_time | double precision | | |
187 shared_blks_hit | bigint | | |
188 shared_blks_read | bigint | | |
189 shared_blks_dirtied | bigint | | |
190 shared_blks_written | bigint | | |
191 local_blks_hit | bigint | | |
192 local_blks_read | bigint | | |
193 local_blks_dirtied | bigint | | |
194 local_blks_written | bigint | | |
195 temp_blks_read | bigint | | |
196 temp_blks_written | bigint | | |
197 blk_read_time | double precision | | |
198 blk_write_time | double precision | | |
199 wal_records | bigint | | |
200 wal_fpi | bigint | | |
201 wal_bytes | numeric | | |
203 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
209 -- New functions and views for pg_stat_statements in 1.10
210 AlTER EXTENSION pg_stat_statements UPDATE TO '1.10';
211 \d pg_stat_statements
212 View "public.pg_stat_statements"
213 Column | Type | Collation | Nullable | Default
214 ------------------------+------------------+-----------+----------+---------
217 toplevel | boolean | | |
218 queryid | bigint | | |
221 total_plan_time | double precision | | |
222 min_plan_time | double precision | | |
223 max_plan_time | double precision | | |
224 mean_plan_time | double precision | | |
225 stddev_plan_time | double precision | | |
227 total_exec_time | double precision | | |
228 min_exec_time | double precision | | |
229 max_exec_time | double precision | | |
230 mean_exec_time | double precision | | |
231 stddev_exec_time | double precision | | |
233 shared_blks_hit | bigint | | |
234 shared_blks_read | bigint | | |
235 shared_blks_dirtied | bigint | | |
236 shared_blks_written | bigint | | |
237 local_blks_hit | bigint | | |
238 local_blks_read | bigint | | |
239 local_blks_dirtied | bigint | | |
240 local_blks_written | bigint | | |
241 temp_blks_read | bigint | | |
242 temp_blks_written | bigint | | |
243 blk_read_time | double precision | | |
244 blk_write_time | double precision | | |
245 temp_blk_read_time | double precision | | |
246 temp_blk_write_time | double precision | | |
247 wal_records | bigint | | |
248 wal_fpi | bigint | | |
249 wal_bytes | numeric | | |
250 jit_functions | bigint | | |
251 jit_generation_time | double precision | | |
252 jit_inlining_count | bigint | | |
253 jit_inlining_time | double precision | | |
254 jit_optimization_count | bigint | | |
255 jit_optimization_time | double precision | | |
256 jit_emission_count | bigint | | |
257 jit_emission_time | double precision | | |
259 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
265 -- New functions and views for pg_stat_statements in 1.11
266 AlTER EXTENSION pg_stat_statements UPDATE TO '1.11';
267 \d pg_stat_statements
268 View "public.pg_stat_statements"
269 Column | Type | Collation | Nullable | Default
270 ------------------------+--------------------------+-----------+----------+---------
273 toplevel | boolean | | |
274 queryid | bigint | | |
277 total_plan_time | double precision | | |
278 min_plan_time | double precision | | |
279 max_plan_time | double precision | | |
280 mean_plan_time | double precision | | |
281 stddev_plan_time | double precision | | |
283 total_exec_time | double precision | | |
284 min_exec_time | double precision | | |
285 max_exec_time | double precision | | |
286 mean_exec_time | double precision | | |
287 stddev_exec_time | double precision | | |
289 shared_blks_hit | bigint | | |
290 shared_blks_read | bigint | | |
291 shared_blks_dirtied | bigint | | |
292 shared_blks_written | bigint | | |
293 local_blks_hit | bigint | | |
294 local_blks_read | bigint | | |
295 local_blks_dirtied | bigint | | |
296 local_blks_written | bigint | | |
297 temp_blks_read | bigint | | |
298 temp_blks_written | bigint | | |
299 shared_blk_read_time | double precision | | |
300 shared_blk_write_time | double precision | | |
301 local_blk_read_time | double precision | | |
302 local_blk_write_time | double precision | | |
303 temp_blk_read_time | double precision | | |
304 temp_blk_write_time | double precision | | |
305 wal_records | bigint | | |
306 wal_fpi | bigint | | |
307 wal_bytes | numeric | | |
308 jit_functions | bigint | | |
309 jit_generation_time | double precision | | |
310 jit_inlining_count | bigint | | |
311 jit_inlining_time | double precision | | |
312 jit_optimization_count | bigint | | |
313 jit_optimization_time | double precision | | |
314 jit_emission_count | bigint | | |
315 jit_emission_time | double precision | | |
316 jit_deform_count | bigint | | |
317 jit_deform_time | double precision | | |
318 stats_since | timestamp with time zone | | |
319 minmax_stats_since | timestamp with time zone | | |
321 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
327 -- New parameter minmax_only of pg_stat_statements_reset function
328 SELECT pg_get_functiondef('pg_stat_statements_reset'::regproc);
330 -------------------------------------------------------------------------------------------------------------------------------------------------------------------
331 CREATE OR REPLACE FUNCTION public.pg_stat_statements_reset(userid oid DEFAULT 0, dbid oid DEFAULT 0, queryid bigint DEFAULT 0, minmax_only boolean DEFAULT false)+
332 RETURNS timestamp with time zone +
334 PARALLEL SAFE STRICT +
335 AS '$libdir/pg_stat_statements', $function$pg_stat_statements_reset_1_11$function$ +
339 SELECT pg_stat_statements_reset() IS NOT NULL AS t;
345 -- New functions and views for pg_stat_statements in 1.12
346 AlTER EXTENSION pg_stat_statements UPDATE TO '1.12';
347 \d pg_stat_statements
348 View "public.pg_stat_statements"
349 Column | Type | Collation | Nullable | Default
350 ----------------------------+--------------------------+-----------+----------+---------
353 toplevel | boolean | | |
354 queryid | bigint | | |
357 total_plan_time | double precision | | |
358 min_plan_time | double precision | | |
359 max_plan_time | double precision | | |
360 mean_plan_time | double precision | | |
361 stddev_plan_time | double precision | | |
363 total_exec_time | double precision | | |
364 min_exec_time | double precision | | |
365 max_exec_time | double precision | | |
366 mean_exec_time | double precision | | |
367 stddev_exec_time | double precision | | |
369 shared_blks_hit | bigint | | |
370 shared_blks_read | bigint | | |
371 shared_blks_dirtied | bigint | | |
372 shared_blks_written | bigint | | |
373 local_blks_hit | bigint | | |
374 local_blks_read | bigint | | |
375 local_blks_dirtied | bigint | | |
376 local_blks_written | bigint | | |
377 temp_blks_read | bigint | | |
378 temp_blks_written | bigint | | |
379 shared_blk_read_time | double precision | | |
380 shared_blk_write_time | double precision | | |
381 local_blk_read_time | double precision | | |
382 local_blk_write_time | double precision | | |
383 temp_blk_read_time | double precision | | |
384 temp_blk_write_time | double precision | | |
385 wal_records | bigint | | |
386 wal_fpi | bigint | | |
387 wal_bytes | numeric | | |
388 jit_functions | bigint | | |
389 jit_generation_time | double precision | | |
390 jit_inlining_count | bigint | | |
391 jit_inlining_time | double precision | | |
392 jit_optimization_count | bigint | | |
393 jit_optimization_time | double precision | | |
394 jit_emission_count | bigint | | |
395 jit_emission_time | double precision | | |
396 jit_deform_count | bigint | | |
397 jit_deform_time | double precision | | |
398 parallel_workers_to_launch | bigint | | |
399 parallel_workers_launched | bigint | | |
400 stats_since | timestamp with time zone | | |
401 minmax_stats_since | timestamp with time zone | | |
403 SELECT count(*) > 0 AS has_data FROM pg_stat_statements;
409 DROP EXTENSION pg_stat_statements;